Home Forums WinForms controls Xceed Grid for WinForms Datarows Remove Reply To: Datarows Remove

User (Old forums)
Member
Post count: 23064

You cannot use a For Each on a collection from which you delete items in that very loop. You need to use a regular For loop, and go from DataRows.Count – 1 to 0, i.e :

For i = grdagentes.DataRows.Count – 1 to 0 Step -1
grdagentes.DataRows(i).Remove()
Next i

However, you can simply use the DataRows.Clear(), and it will do it for you!

Imported from legacy forums. Posted by André (had 2946 views)