Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I track the old value in a datagridview cell?

I have a datgridview and I want to do editing of the values of cell on that datagridview. But when I edit a cell value the old value goes away. So is there a way to track or fetch the old value of that edited cell?

thanks

like image 301
sniff_bits Avatar asked Jan 12 '23 11:01

sniff_bits


1 Answers

Take a look at the CellValidating event:

void dgv_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
{
    var oldValue = dgv[e.ColumnIndex, e.RowIndex].Value;
    var newValue = e.FormattedValue;
}
like image 163
HABJAN Avatar answered Jan 17 '23 13:01

HABJAN