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
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
>> 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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
foooo-ey!
avi
avi