You can can use
RejectChanges
. It will revert all changes since the last call to
AcceptChanges
.
I guess the trick is to know when to call
AcceptChanges
.
It should be done before the next row is added.
If you have a a function for adding a new row to the data table you can do likes this.
private DataTable dt = new DataTable();
private void AddRow()
{
dt.AcceptChanges();
dt.Rows.Add(param1, param2, etc);
}
private void OnUndo()
{
dt.RejectChanges();
}
This is a very simplistic approach.