It can be done like this. When reading you could store the value in both the cell.Value
property. When the cell.Value
changes you can detect it by comparing it to the cell.Tag
. Then when you successfully store the input data, you can simply update the cell.Tag
with the cell.Value
There are better ways though. You can read into DataGridView.VirtualMode Property (System.Windows.Forms) | Microsoft Docs
]. This allows you to work with a list of objects you can use to read and write.
Also you can look into binding. This is a little harder to do (imo)