Any solution is going to involve using an event that definitely will fire to stop the Data Grid View from thinking it’s in edit mode.
Further, let’s say that you’d like to know as soon as the user has made a change to their selection.
You might want to handle this for a number of reasons: to enable a save button, to change the appearance of selected items, to display a pop-up window, or to check for consistency against other choices.
It turns out that this is trickier than it might seem and doesn’t work great out of the box from .
This has the added bonus of not firing when you have clicked outside of the checkbox area, but still falls perhaps under the same category of not being entirely clear to someone unfamiliar with this issue why this particular event should force the grid to exit edit mode.
After looking into the problem at some length, MSDN actually seems to offer the best solution right on their Cell Content Click event page.
I like that it tells us very specifically what has happened to the grid at the point in time when the event is raised and handled.
It’s important to note that this event will get called twice, once on changing the state of the cell to dirty (before committing changes) and once when changing the cell state back to ‘clean’ (after the changes have been committed).
This makes more sense when we think about a Text Box column.
We would not want the Cell Value Changed event firing every single time a letter was added to a person’s last name.
Still, it doesn’t make much sense when we think about the way Check Box’s work, in that, they can only ever be On or Off, and that once you have made your selection, you’re probably pretty confident that you want to change the value.
I’d rather code to do exactly what it says it’s doing.