Hi to all
I try to delete row from DataTable.
When I make row.Delete sometimes I get this exception
System.ArgumentOutOfRangeException
I trace a little bit the problem and I think found something
When I make delete in DataTable is invoked RecordStateChanged which in
Turn meke this
int i = LiveIndexes.Count;
and then
for (int j = 0; j < i; j++)
{
if (record1 != -1 && record2 != -1)
{
((Index)indexes[j]).RecordStateChanged(record1, oldState1,
newState1, record2, oldState2, newState2);
}
...
From here we see that this method calls RecordStateChanged in
System.Data.Index and some times the LiveIndexes.Count is changed, but i is
unchanged and here comes the problem
If in the beginning i = 21, after this call LiveIndexes.Count = 20 , but i
is still 21 and it make access by index 20 which course exception.
I think that because System.Data.Index. RecordStateChanged fire event
OnListChanged which in turn can change indexes ArrrayList.
Can somebody help to resolve the probem?
Thanks