View Single Post
Old 03-24-2006, 07:47 AM   #6 (permalink)
kyoryu
Registered User
 
Join Date: Apr 2003
Posts: 34
kyoryu is on a distinguished road
Quote:
Originally Posted by khanhlq
UGMain = UltraGrid
I deleted one row, but index wrong and can't delete in the right. Plz help me
While I'm not familiar with UltraGrid, it looks to me like the act of deleting the first row may be invalidating your iterator.

Adding the rows to be deleted to a separate collection, and using that to do the actual deletion is an option... using a list and then just popping off the values may work well.

Another thing that can work well for deleting items from a list is iterating over the list, by index instead of foreach, but doing so in reverse. This guarantees that your next lower index is still valid.
kyoryu is offline   Reply With Quote