We help IT Professionals succeed at work.

DataGridView Checkbox Cell detect check

ict-torquilclark
on
Medium Priority
1,178 Views
Last Modified: 2012-05-12
How can I detect when a datagridview checkbox cell is checked/unchecked?
Comment
Watch Question

Try this

((DataGridViewCheckBoxCell)e.Rows[0].Cells[0]).Selected = true

Open in new window

Author

Commented:
i mean which even trigger do i need to use?
check this

If CBool(dataGridView1.Rows[e.RowIndex].Cells[0].Value) = True Then
      'Check box checked
Else
      'Check box Unchecked
End If

Open in new window

dataGridView1_CellContentClick event
Shahan AyyubSenior Software Engineer
CERTIFIED EXPERT

Commented:
Hi!

You an use CellContentClick event as other expert suggested, but i have another advice which i have experienced while working with Datagridview having checkboxColumn, sometimes when you checked a cell and want to access the value you will not get the updated value (like if you changed 'False' to 'True') you may get 'False'. So you should use:

DatagridView1.EndEdit() 

Open in new window


before accessing the value the checkboxcell value.