A
Andrea Caldarone
Hi all,
I've a DataTable, and from my UI a such user deletes one or more rows from
it, I wish to get the deleted rows from the DataTable. I have to perform a
loop trough the deleted rows and invoke the Row.Accept changes method, but
if I try something like this:
dim rX as DataRow
For Each rX in MyTable.Rows
If rX.RowState=RowState.Deleted Then
rX.AcceptChanges
End If
Next
I get an execption: the collection is changed. When I invoke rX.AccepChanges
method of a deleted rows, the row is removed from the .Rows collection of
the datatable and the loop I'm performing fails.
I've a DataTable, and from my UI a such user deletes one or more rows from
it, I wish to get the deleted rows from the DataTable. I have to perform a
loop trough the deleted rows and invoke the Row.Accept changes method, but
if I try something like this:
dim rX as DataRow
For Each rX in MyTable.Rows
If rX.RowState=RowState.Deleted Then
rX.AcceptChanges
End If
Next
I get an execption: the collection is changed. When I invoke rX.AccepChanges
method of a deleted rows, the row is removed from the .Rows collection of
the datatable and the loop I'm performing fails.