|
-
May 21st, 2010, 01:47 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] How can i exit out of a For Next loop? Is it possible?
Is there a way to exit out of a For Next loop? Like
Code:
For i = 0 to 5
If i = 3 then
'exit loop
End If
Next i
-
May 21st, 2010, 01:48 PM
#2
Re: How can i exit out of a For Next loop? Is it possible?
Code:
For i = 0 to 5
If i = 3 then
Exit For
End If
Next i
-
May 21st, 2010, 02:54 PM
#3
Re: How can i exit out of a For Next loop? Is it possible?
You also have the Exit Do for exiting Do Loops if you ever need it.
-
May 21st, 2010, 04:28 PM
#4
Frenzied Member
Re: How can i exit out of a For Next loop? Is it possible?
Or Exit While for exiting While Loops.
Exit Sub / Exit Function too
-
May 21st, 2010, 04:48 PM
#5
Re: How can i exit out of a For Next loop? Is it possible?
Actually, there's no Exit While for While Wend loops in VB6. (but I think there is in .Net, not sure, I don't use it much)
EDIT: Valid Exits are Do, For, Sub, Function and Property.
Last edited by baja_yu; May 21st, 2010 at 04:54 PM.
-
May 21st, 2010, 06:26 PM
#6
Thread Starter
Fanatic Member
Re: How can i exit out of a For Next loop? Is it possible?
Okay. Thanks everyone for your awnseres!
-
May 21st, 2010, 09:20 PM
#7
Re: [RESOLVED] How can i exit out of a For Next loop? Is it possible?
For nested loops, the simplest way is using GoTo, in case you ever run into this problem. You could probably use a boolean check to exit each loop consecutively... but this is probably even less ideal than GoTo.
Software I use and highly recommend: Opera, Miranda IM, Peerblock, Winamp, Unlocker Assistant, JoyToKey, Virtual CloneDrive, Secunia PSI, ExplorerXP, GOM Player, Real Alternative, Quicktime Alternative,Sumatra PDF, and non-freeware: Photoshop and VB6( ).
My codebank: AllRGB, Rounded Rectangle(math), Binary Server, Buddy Paint, LoadPictureGDI+, System GUID/Volume Serial, HexToAsc, List all processes and their paths, quasiString matching
Strings(search, extraction, retrieval etc): Retrieve BBCode Link from HTML, RemoveBetween ()'s, strFindBetween(str1,str2), Insert text in HTML, HTML - GetSpanByID
-
May 21st, 2010, 09:42 PM
#8
Thread Starter
Fanatic Member
Re: [RESOLVED] How can i exit out of a For Next loop? Is it possible?
So, would this maybe be why this problem of mine happens: http://www.vbforums.com/showthread.p...26#post3806126 ?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|