For..Next--How to count Backwards

E

Eric Cathell

I am using an arraylist to process data....the unique problem i have run
into is that if I delete one of the indexed values the arraylist is
reindexed and i get an exception thrown. I need to start at the last item in
the arraylist and go backwards....a for next loop doesnt seem to let me do
this...

for i =arraylist.count-1 to 0
'do stuff here
next

just skips to the loop entirely...any help?

Thanks
 
H

Herfried K. Wagner

* Eric Cathell said:
I am using an arraylist to process data....the unique problem i have run
into is that if I delete one of the indexed values the arraylist is
reindexed and i get an exception thrown. I need to start at the last item in
the arraylist and go backwards....a for next loop doesnt seem to let me do
this...

for i =arraylist.count-1 to 0
'do stuff here
next

\\\
For i = MyArrayList.Count - 1 To 0 Step -1
...
Next i
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top