How to verify if a DataGridViewCheckBoxCell is Checked

前端 未结 7 1681
小鲜肉
小鲜肉 2021-01-11 10:45

I have bound a data table to a DataGridView, this data table has a column called \"Status\" which is of type Boolean. I can set the value to

7条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-11 11:25

    Another issue that may be encountered is this:

    When the user clicks the cell to check or uncheck the box, the underlying value will not be changed until the cell loses focus.

    This will not be an issue if the code in question is in a button, since the cell will lose focus when you click the button. But if your code is fired from a timer, you may still be checking the 'old' value.

    See my other answer here: https://stackoverflow.com/a/22080846/1015072

提交回复
热议问题