473,569 Members | 2,611 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.coun t-1 to 0
'do stuff here
next

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

Thanks
Nov 20 '05 #1
3 3865
> for i =arraylist.coun t-1 to 0 step -1
'do stuff here
next

"Eric Cathell" <ec******@mount aire.com> wrote in message
news:Ok******** ******@TK2MSFTN GP11.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.coun t-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.coun t-1 to 0
'do stuff here
next


\\\
For i = MyArrayList.Cou nt - 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.ac tivevb.de> wrote in message
news:3F******** ******@m.active vb.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.coun t-1 to 0
'do stuff here
next


\\\
For i = MyArrayList.Cou nt - 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
17059
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
3605
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. I have a separate text file that holds the list of uri strings that I want to count and then this code. The log is sampleLog.txt. The problem is...
18
5909
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. More holidays can be added easily. Also, there is a boolean flag for including or excluding Saturdays or Sundays as part of the work week. The only...
2
5572
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 happen. Did I forgot something?? int Minutes = 15;
6
44009
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
342
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 one field adata from each match but also be able to step forward and backwards?!
2
1824
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" class="text"><font
4
3566
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 order starting with the last line first..... Any assistance would be greatly appreciated.... Thanks, Chris
3
2235
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? <?php echo '<form action="index.php" method="post">'; echo '<textarea name="input" cols="12" rows="20">'; echo '</textarea><br>'; echo '<input...
0
8125
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7676
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7974
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.