I want to run CellEndEdit only when the cell value changes, I tried to put
if (dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == e.FormattedValue.ToString())
return;
in the CellValidation event, the Cell Validation event returns, but CellEndEdit also starts and updates the fields, updated dateand bywhen the user just went into edit mode and left without changing the cell values.
By the time they reach CellEndEdit, CellValuethey Formatted Valueare the same as they could not be installed in CellEndEdit.
The trivial solution is to set the flag in CellValidation and return CellEndEdit when the flag is set, but this seems to be an error-prone solution, since there are about 10 pointers in the form. So, 10 flags?
source
share