Datagridview cellvalidating not firing

07 Feb

These events are not fired when the user cancels edit mode, which is good. They do almost what I want but they are also fired when the user cancels edit mode by pressing ESC.

In my C# application I have a data-bound Data Grid View.

I need to perform a task whenever the user ordinarily ends edit mode (no matter if the user actually modified the value or not; but not when the user cancels edit mode by pressing ESC) in a Text Box column of a is only set when the user actually changes the value.

But I also need to perform the task when the user ordinarily ends edit mode without having changed anything.

When I click on the Cancel button I just want to close the form.

I don't want any validation for the edit box to be executed. Here is an important detail: if the validation fails, then If the validation occurs when the edit box loses focus, nothing about the the cancel button is going to stop that from happening.