DataGridView checkbox.


M

Mr. X.

When I use dataGridView, and one of it's elements is a checkBox.
How can I catch the event, exactly when the checkBox is changed.
CellValueChanged is not good enough, since the event occurs after both two
steps :
1. I change the value of the cell.
2. I move to another cell.

I want exactly when the checkBox.checked is changed
(DataGridViewCheckBoxCell).

Thanks :)
 
Ad

Advertisements

P

Phill W.

When I use dataGridView, and one of it's elements is a checkBox.
How can I catch the event, exactly when the checkBox is changed.
I want exactly when the checkBox.checked is changed
(DataGridViewCheckBoxCell).

Handle the CurrentCellDirtyStateChanged event; in this routine, if the
CurrentCell happens to be a DataGridViewCheckBoxCell, call CommitEdit;
that should get the CellChanged event to fire straight away.

HTH,
Phill W.
 
M

Mr. X.

Thanks.
How can I see the "dirty" new-value.
On CurrentCellDirtyStateChanged, I can see the old-value.

Thanks :)
 
M

Mr. X.

I meant - to check the value of the object to be changed to, and for some
condition do : cancelEdit.

Thanks :)
 
Ad

Advertisements

M

Mr. X.

Thanks.
Everything was solved. Ignore the rest.
(There are situation, that when I do commitEdit, and reach the
CellValueChanged, I am in state of edit mode. co I can do endEdit on some
circumstances,
I.e, when the checkbox is invalid value, for some cases, and I need to
restore it to original value).

Thanks :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top