Basically, I have a DataGridView = grid, and I've hooked the following events:
CellDirtyStateChangedCellValueChangedCellValidating
When I edit a cell (under DataGridViewColumn.ValueType == typeof(uint)), and then click on another cell, then theCellValueChanged event is fired as expected.
However, when I edit a cell, and I click on a column header (while the cell was in edit mode), then theCellValueChanged event is not fired which is NOT expected.
So, anyone expert know why is this? and how to fire the CellValueChanged event on the 2nd scenario?
NOTE:
- the cell is a
DataGridViewTextBoxCellobject - the cell's ValueType is
typeof(uint) the
CellDirtyStateChangedevent is fired but it's not used in case of aDataGridViewTextBoxCell. However, it's used when a cell is a comboBox cell, to simulate (SelectedIndexChangedEvent), for example:publicvoidGrid_CellDirtyStateChanged(Object sender,System.EventArgs e){DataGridView gridSender = sender asDataGridView;if(gridSender.IsCurrentCellDirty&& gridSender.CurrentCell!=null&& gridSender.CurrentCellisDataGridViewComboBoxCell){// This fires the cell value changed handler below gridSender.CommitEdit(DataGridViewDataErrorContexts.Commit);}}