Link to home
Start Free TrialLog in
Avatar of Jess31
Jess31

asked on

DataGridView / CheckBox column?`

I'm using vb.net and DataGridView and Winforms.
What Event should I use when I want to be alerted when the Checkbox has changed?
Avatar of Arabia_vn
Arabia_vn
Flag of Viet Nam image

Datagridview ---> CellValueChanged event
Avatar of Jess31
Jess31

ASKER

This does not work. Only when you leave the Cell, not when the checkbox check changed.
I see. So you want the event raised right after the value of checkbox changed, then to my knowledge there's no way to do that. I tried many different ways on my project but couldn't find any good solution. So i had to use CellValueChanged, not very good but at least it did the job. Someone can do this plz post the solution.
From MSDN.

<MSDN>
In the case of check box cells, however, you will typically want to handle the change immediately. To commit the change when the cell is clicked, you must handle the DataGridView..::.CurrentCellDirtyStateChanged event. In the handler, if the current cell is a check box cell, call the DataGridView..::.CommitEdit method and pass in the Commit value.

</MSDN>

It seems that you need to handle DataGridView.CurrentCellDirtyStateChanged Event.
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.currentcelldirtystatechanged.aspx
ASKER CERTIFIED SOLUTION
Avatar of RameshS
RameshS
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