I have a delete button which does this:
TTDataSet.PunchEventTable.Rows(dgvData.SelectedRows(0).Index).Delete()
The problem is that if I delete row 0 (the 0th index in the DataGridView and in the underlying table, all is well. But now row 1 in the table corresponds to row 0 in the DataGridView, so if I run that code to delete a row again, nothing happens because row 0 in the table is already deleted.
I tried
PunchEventTableBindingSource.EndEdit()
and
TTDataSet.PunchEventTable.AcceptChanges()
after the call to delete, but neither seems to fix the problem. Of course the problem is fixed once Update is called on the DataAdapter, but I didn't want to do that until all of the changes were made, this way I could cancel the changes if the user so wishes.
Is there a way to fix this?
Thanks,
Dave