DatagridView Checkbox Checked?

前端 未结 2 1672
夕颜
夕颜 2021-01-24 10:35

i have a check box in a datagridview windows form and have a event handler cell_Click on cell click i check the datagridview column for a check box it shows true if the cell is

2条回答
  •  礼貌的吻别
    2021-01-24 11:17

    Several things here:

    • the cell click event just means that the user clicked with the mouse button on the data grid view, what you're looking for is probably the CellValueChanged
    • this event will give you the coordinates of the cell that changed. You should check to see if it's in your check box column, then get a reference to the cell and you can check the cell.Value to see if it's true or false. You're not going to find any values on the DataGridViewCheckBoxColumn -- it's going to be at the cell level, and you'll always find the value stored in cell.Value, no matter what type of column it is.

提交回复
热议问题