For your information, CancelEdit() can only “Cancel” restore what was copied by BeginEdit(). In other words, if BeginEdit() was not initially called, CancelEdit() can not have any effect on this row.
The LeavingEdit event is perhaps what you should be looking for. As the documentation says:
The LeavingEdit event is raised after a cell has been edited. It provides information on the cell that has been edited and provides the opportunity to prevent the cell editor from being removed, leaving the cell in edit mode, or to change the new value that is about to be assigned to the cell.
Keep in mind that the LeavingEdit event will not be raised if the LeaveEdit method is called with its commit parameter set to false.
For more informations regarding how to use the LeavingEdit event, you can read this section:
or access through Start menu by clicking “Start -> Programs -> Xceed Components -> .NET Components -> Windows Forms -> Grid for .NET 3.8 -> Documentation” and then going to “Task-Based Help -> Events -> How to you the LeavingEdit event”.
You will find the a sample application (C# et VB.NET).
Imported from legacy forums. Posted by Ghislain (had 946 views)