Link to home
Start Free TrialLog in
Avatar of progtw
progtw

asked on

Is there a special VB statement to let you jump to the next iteration in a loop?

Jump to next iteration in a loop

Say you got a loop like the one below.  How do I accomplish the same task without the goto statement?

  For Each MyControl In ControlCollection
    If TypeOf MyControl Is Whatever Then Goto SkipThisOne
    ' Provide code here to work with valid MyControl
SkipThisOne:
  Next MyControl

And, NO - I do NOT mean do as follows...

For Each MyControl In ControlCollection
        If not TypeOf MyControl Is Whatever Then
        ' Provide code here to work with valid MyControl
       end if
       Next MyControl

tia

avi

 
 
Avatar of drydenhogg
drydenhogg

In terms of a built in collection type used in a for..each loop basically no. You have the choices of using program flow logic or goto statements, the latter of which I would say never use.


SOLUTION
Avatar of doobdave
doobdave

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of progtw

ASKER

to doobdave:

>> What's wrong with using the second method:

But there isn't a special VB statement  to let you jump to the next iteration in a loop?

avi
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of progtw

ASKER

foooo-ey!

avi