|
-
Dec 29th, 2005, 11:48 AM
#1
Thread Starter
Lively Member
[RESOLVED] Getting out of a For Next Loop
Hi
I am still learning and apologize for insulting anyones intelligence...
How do you get out of a For/Next loop with
If x=y then (get out of loop)
Suffering brain fog at the moment
Thanks
Mike
-
Dec 29th, 2005, 11:49 AM
#2
Re: Getting out of a For Next Loop
-
Dec 29th, 2005, 12:09 PM
#3
Thread Starter
Lively Member
Re: Getting out of a For Next Loop
 Originally Posted by Hack
Thanks
However I get "Next without for Error"
VB Code:
For z = 0 To 19
If (a + z + 1) > 20 Then
Exit For
If Abs(Text2(0 + z).Text - Text2(a + z + 1).Text) <= y Then w = w + 1
Next z
-
Dec 29th, 2005, 12:11 PM
#4
Re: Getting out of a For Next Loop
 Originally Posted by leachim
Thanks
However I get "Next without for Error"
VB Code:
For z = 0 To 19
If (a + z + 1) > 20 Then
Exit For
If Abs(Text2(0 + z).Text - Text2(a + z + 1).Text) <= y Then w = w + 1
Next z
That makes sense. You need to add an End If after your Exit For.
-
Dec 29th, 2005, 12:24 PM
#5
Thread Starter
Lively Member
Re: Getting out of a For Next Loop
Yep
Works
It also works without the End If if you have "Then Exit For" on the same line.
I have the "Idiots Guide to VB 6" - although Seem to learn better from Video or DVD - Is there such a resource ?
The Idiots Guide doesn't tell me what I have just learnt - Can you recommend a book/video that is easy to learn from
Thanks Again
Mike
-
Dec 29th, 2005, 12:37 PM
#6
Re: Getting out of a For Next Loop
 Originally Posted by leachim
Yep
Works
It also works without the End If if you have "Then Exit For" on the same line.
I have the "Idiots Guide to VB 6" - although Seem to learn better from Video or DVD - Is there such a resource ?
The Idiots Guide doesn't tell me what I have just learnt - Can you recommend a book/video that is easy to learn from
Thanks Again
Mike
This is my Bible!!!!!!!!
See if you can get a used copy (I believe it is out of print).
-
Dec 29th, 2005, 12:43 PM
#7
Re: Getting out of a For Next Loop
My Bible is Tricks of the 3D Game Programming Gurus.
-
Dec 29th, 2005, 12:54 PM
#8
Thread Starter
Lively Member
Re: Getting out of a For Next Loop
Just ordered one for $11 inc delivery to UK !!
Forgot to ask what they were new !!
1 drawback is that it was written for VB 5 ?
Mike
-
Dec 29th, 2005, 12:59 PM
#9
Re: Getting out of a For Next Loop
 Originally Posted by leachim
Just ordered one for $11 inc delivery to UK !!
Forgot to ask what they were new !!
1 drawback is that it was written for VB 5 ?
Mike
I've had it for years and years and still refer to it occassionally.
There are features of VB6 not found in VB5, that is true, however, it will cover the vast majority of things that you will be interested in learning.
Also, take a look as some of these links. I have no idea what is good or bad, but some of the titles sound like something you would be interested in.
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
|