PC Review


Reply
Thread Tools Rate Thread

2 list box iteration

 
 
iccsi
Guest
Posts: n/a
 
      4th Jun 2010
I tried to process something for 2 list box and need to iterate 2 of
them and one iterates selected items one iterates all list

For i = 1 To lst1.ListCount
For Each VarItem In lst2.ItemsSelected
' my loop is here
Next VarItem
Next i

It seems that every VarItem increase the i increase as well.
I want VarItem to be inner loop which should be finish all seleted
item and go to next i.

Where is wrong to use above code?

Any information is great appreciated,
 
Reply With Quote
 
 
 
 
Tom van Stiphout
Guest
Posts: n/a
 
      4th Jun 2010
On Fri, 4 Jun 2010 07:49:08 -0700 (PDT), iccsi <(E-Mail Removed)>
wrote:

No, this is indeed a nested loop and i is not incremented until we
loop over all items of the inner loop.
Set a breakpoint at the top of the code and step through it to see for
yourself.

-Tom.
Microsoft Access MVP


>I tried to process something for 2 list box and need to iterate 2 of
>them and one iterates selected items one iterates all list
>
> For i = 1 To lst1.ListCount
> For Each VarItem In lst2.ItemsSelected
> ' my loop is here
> Next VarItem
> Next i
>
>It seems that every VarItem increase the i increase as well.
>I want VarItem to be inner loop which should be finish all seleted
>item and go to next i.
>
>Where is wrong to use above code?
>
>Any information is great appreciated,

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Best practice to modify list during iteration MM Microsoft C# .NET 1 6th Jun 2010 04:15 AM
forward-iteration vs reverse-iteration John A Grandy Microsoft C# .NET 3 28th May 2008 11:13 PM
dragging a list of numbers/repeat vs. iteration RoLaAus Microsoft Excel Discussion 4 5th Feb 2008 08:34 PM
iteration =?Utf-8?B?R2FyZXRoIE1pbHRvbg==?= Microsoft Excel Misc 1 28th Mar 2007 04:18 PM
modify list value with foreach iteration variable Bob Microsoft C# .NET 2 24th May 2006 10:31 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:42 PM.