Link to home
Start Free TrialLog in
Avatar of ict-torquilclark
ict-torquilclark

asked on

DataGridView Checkbox Cell detect check

How can I detect when a datagridview checkbox cell is checked/unchecked?
Avatar of sachinpatil10d
sachinpatil10d
Flag of India image

Try this

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

Open in new window

Avatar of ict-torquilclark
ict-torquilclark

ASKER

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

ASKER CERTIFIED SOLUTION
Avatar of sachinpatil10d
sachinpatil10d
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Shahan Ayyub
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.