Click here to Skip to main content
14,698,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a checkbox defined in a datagridview. I can tell when it is clicked, but I don't know how to determine if the box is checked or unchecked. Can anyone help? This seems like a very simple problem, but all of the 'net research I have done has not helped.

I am writing this in VB.Net, in case you intend to supply a code snippet.

Thanks in advance!

What I have tried:

Research, research, and more research
Updated 8-Jul-20 6:01am

1 solution

Assuming you're using a DataGridViewCheckBoxColumn:
c# - How to verify if a DataGridViewCheckBoxCell is Checked - Stack Overflow[^]

Dim cbxCell As DataGridViewCheckBoxCell = DirectCast(senderGrid.Rows(e.RowIndex).Cells(e.ColumnIndex), DataGridViewCheckBoxCell)

Dim isChecked As Boolean = cbxCell.Value IsNot Nothing AndAlso CBool(cbxCell.Value)
Dave in NC 8-Jul-20 11:37am
I am having trouble converting that to VB.Net. Can you help? Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900