473,395 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

For..Next--How to count Backwards

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
Nov 20 '05 #1
3 3850
> for i =arraylist.count-1 to 0 step -1
'do stuff here
next

"Eric Cathell" <ec******@mountaire.com> wrote in message
news:Ok**************@TK2MSFTNGP11.phx.gbl... 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

Nov 20 '05 #2
* Eric Cathell schrieb:
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
///

--
Herfried K. Wagner
Microsoft MVP
<http://www.mvps.org/dotnet>

Nov 20 '05 #3
thanks all ...forgot about that pesky step-1 tag..hehe

Eric
"Herfried K. Wagner" <hi*******@m.activevb.de> wrote in message
news:3F**************@m.activevb.de...
* Eric Cathell schrieb:
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
///

--
Herfried K. Wagner
Microsoft MVP
<http://www.mvps.org/dotnet>

Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Chris | last post by:
Can anybody help. I need to read a txt file backwords line by line. Can anybody help me do this. Thanks Chris
3
by: Jonathan Driller | last post by:
I am very new to this and would greatly appreciate some insight. I am trying to learn Python by doing something useful; write a script that will count and output my aggregated visits to my website....
18
by: jimfortune | last post by:
I have an A97 module called modWorkdayFunctions in: http://www.oakland.edu/~fortune/WorkdayFunctions.zip It allows the counting of workdays taking into consideration up to 11 U.S. holidays. ...
2
by: Robert Mayer | last post by:
Hello! I would like to count 15 Minutes (in this style: 15:00, 14:59, 14:58 ...) backwards with a Timer and want to show it on a Label. The Time is displayed correctly (15:00), but nothing...
6
by: Neil Patel | last post by:
I have a log file that puts the most recent record at the bottom of the file. Each line is delimited by a \r\n Does anyone know how to seek to the end of the file and start reading backwards?
1
by: Adrian | last post by:
Hi I'm lost! so please help me... I have the following code I want to simply retrieve all the record that matches the SQL statement, I want to know how many records matched and display only...
2
by: roN | last post by:
Hey, I got following: <form name="Formular" method="post" onSubmit="return chkFormular()" action="mail.php" enctype="text/plain"> .... .... .... <td align="right" valign="top"...
4
by: Stupid48 | last post by:
I'm trying to do a simple task but can't seem to find a solution. How do I read lines from a text file backwards. i.e. I want to select the last 20 lines of a text file and display them in...
3
by: CoreyWhite | last post by:
This code runs @ http://www.ckoogle.com but the trouble is once I get the list backwards, and in an array. I can't sort the new array into alphabetical order. Anyone know a way to do it? ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.