I want to restore the previous value of a cell of a DataGridView. I am currently using the ESC button but I do not want to use it. How can I achieve this?
if (string.IsNullOrEmpty(e.FormattedValue.ToString()))
If this condition is true, I want to re-assign the previou value of the cell and keep control in cell itself. The above code is executed on CellValidating event.
Try this:
if (string.IsNullOrEmpty(e.FormattedValue.ToString()))
{
dataGridView1.CancelEdit();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With