The methods are called and events raised in the following order when the value of a cell is being edited by the end-user:
F2 is pressed on any cell other than an InsertionCell:
The cell's EnterEdit method is called.
The parent row's BeginEdit method is called.
The cell's EnteringEdit event is raised.
F2 is pressed on an InsertionCell:
The cell's EnterEdit method is called.
The InsertionRow's BeginEdit method is called.
The AddNew method is called on the grid's collection of DataRows.
The grid's InitializingNewDataRow event is raised to initialize the default values of the newly created underlying DataRow.
The cell's EnteringEdit event is raised.
Tab is pressed (current cell changes):
The cell's LeaveEdit method is called with its commit parameter set to true.
The Validating event is raised on the control that was used to edit the cell's content.
The cell's LeavingEdit event is raised. If the value of the cell fails the validation process, the cell's ValidationError event is raised.
The cell's ValueChanging event is raised. If the operation is cancelled, no other methods are called or events raised.
The cell's ValueChanged event is raised.
The cell's parent row's CellValueChanged event is raised.
Enter is pressed on any cell other than an InsertionCell or the current row changes:
The CellRow's EndEdit method is called raising the row's EndingEdit event. If the value of one of the cell's in the row fails the validation process, the row's ValidationError event is raised.
In the EndingEdit event, if the operation is cancelled, the CellRow's CancelEdit method is called raising the cell's ValueChanged event followed by the CellRow's CellValueChanged event.
In the EndingEdit event, if the operation is not cancelled and the row is a DataRow, the DataRow's CellValueChanged, DataRowsChanged and SiblingDataRowsChanged events are raised.
Enter is pressed on an InsertionCell or the current row changes:
The InsertionRow's EndEdit method is called raising the EndingEdit event.
In the InsertionRow's EndingEdit event, if the operation is cancelled, the InsertionRow's ValidationError event is raised followed by a call to the underlying CancelEdit method.
If the operation is not cancelled in the InsertionRow's EndingEdit event , the underlying DataRow's EndEdit method is called raising the EndingEdit event followed by the CellValueChanged, DataRowsChanged and SiblingDataRowsChanged events.
If an error occurs while calling the underlying DataRow's EndEdit method, the DataRow's ValidationError event is raised
In the DataRow's EndingEdit event, if the operation is cancelled, the DataRow's ValidationError event is raised.
In the DataRow's ValidationError event, if the operation is cancelled, the DataRow's CancelEdit and Remove methods are called.
If the operation is not cancelled in the DataRow's ValidationError event, the InsertionRow's ValidationError is raised.
Escape is pressed when editing a cell:
The cell's LeaveEdit is called with its commit parameter set to false.
Escape is pressed when a cell is not being edited in an InsertionRow:
The InsertionRow's CancelEdit method is called followed by a call to the underlying DataRows CancelEdit method.
The underlying DataRow's Remove method is then called.
Escape is pressed when a cell is not being edited in any row other than an InsertionRow:
The row's CancelEdit method is called.
The cell's ValueChanged event is raised followed by the parent row's CellValueChanged event.
The methods are called and events raised in the following order when a new row is being added to the grid by code:
The AddNew method is called on the grid's collection of DataRows.
The grid's InitializingNewDataRow event is raised to initialize the default values of the newly created DataRow.
The methods are called and events raised in the following order when a new row is being committed to the grid by code:
The DataRow's EndEdit method is called raising the row's EndingEdit event. If the value of one of the cell's in the row fails the validation process, the row's ValidationError event is raised.
In the EndingEdit event, if the operation is cancelled, the DataRow's CancelEdit method is called raising the cell's ValueChanging and ValueChanged events.
The DataRow's CellValueChanged event is raised as well as the DataRowsChanged and SiblingDataRowsChanged events.