Hello,
I tried to remove a row from a dataset while looping through the dataset, but it seems other rows are not moving up. I am getting an error message "IndexOutofRange Exception was unhandeled, There is no row at position 21." and i have 30 rows in the dataset.
Here is the code and what i tried to do:
Once it removes the row and moves to the next row, i get the error message. Does any one know why i am getting this error?
Thanks
I tried to remove a row from a dataset while looping through the dataset, but it seems other rows are not moving up. I am getting an error message "IndexOutofRange Exception was unhandeled, There is no row at position 21." and i have 30 rows in the dataset.
Here is the code and what i tried to do:
Code:
Dim I As Integer
For I = 1 To ds.Tables(0).Rows.Count - 1
If IDnumber = 5
ds.Tables(0).Rows.RemoveAt(I)
Else
End if
Next
Once it removes the row and moves to the next row, i get the error message. Does any one know why i am getting this error?
Thanks