|
-
Feb 1st, 2006, 04:47 PM
#1
Thread Starter
Fanatic Member
Reverse For Loop
In my game I am going through a list box of numbers and removing those entries in another list box. So if listA has 1,5,6,8,20 it would remove the entries in the spots 1,5,6,8,20 in listB.
Since when you remove item 1, it changes the location of 5-20 I want to go in reverse, from 20,8,6,5,1. This way none of the items actually change location. I am using a forLoop of
VB Code:
maxArray = frmGameScreen.lstRemove.ListCount - 1
' This loops in revers so it does not affect where the items lie in the listbox
' Example : removing item 20 does not effect where item 4 is
For forLoop = maxArray To 0
frmGameScreen.lstComputer.RemoveItem (frmGameScreen.lstRemove.List(forLoop))
Next forLoop
I have done reverse loops (large to small) before but for some reason the entire forLoop is skipped.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|