I need to complete the task when the user usually ends the editing mode (regardless of whether the user really changed the value or not, but not when the user cancels the editing mode by pressing ESC) in the TextBox DataGridView control column.
I tried several events of the DataGridView element itself and the edit control, but none of them do exactly what I want:
DataGridView.CellValidating and DataGridView.CellValidated :
These events are fired every time the user selects another cell, even if the cell is not in edit mode. I tried to check the IsCurrentCellDirty property inside the CellValidating event. This is almost what I need, but IsCurrentCellDirty set only when the user really changes the value. But I also need to complete the task when the user usually ends the editing mode without changing anything. These events are not triggered when the user cancels the editing mode, which is good.
DataGridView.CellValueChanged
This event also fires too often (it also fires when a cell value is set programmatically).
DataGridView.CellEndEdit
This event is almost what I want. But it also starts when the user cancels the editing mode by pressing ESC. Is there any way to check if the editing mode has been edited inside the CellEndEdit event?
DataGridView.CellParsing
This event is almost what I want. But it does not start when the user ends the editing mode without changing anything.
Validating and Validated edit control events
I registered for these events inside the DataGridView.EditingControlShowing event. They do almost what I want, but they also work when the user cancels the editing mode by pressing ESC. Is there any way to check if the editing mode has been edited inside these events?
Any other suggestions for events that I could register and / or flags that I could check to achieve the desired behavior?
source share