|
-
Sep 27th, 2001, 03:10 PM
#1
Thread Starter
Fanatic Member
stopping all code once form is unloaded?
When I unload a form in the middle of a loop, the form will dissapear but the loop will continue. Is there anyway to stop all the processes going on once the form is unloaded?
-
Sep 27th, 2001, 03:15 PM
#2
PowerPoster
You can check the status of the form in each loop. It it's gone, exit the loop
VB Code:
Dim i As Long
For i = 0 To 5000
Debug.Print i
DoEvents
[b]If Form1.Visible = False Then
Exit For
End If[/b]
Next i
-
Sep 27th, 2001, 03:16 PM
#3
Member
Try this:
Or set a sentinel in the loop.
-
Sep 27th, 2001, 03:24 PM
#4
Thread Starter
Fanatic Member
those are good ideas, but i'm really looking for a way, a command or something that kills it no if and buts.. i need it so it doesn't need a catch like if form1.visible = false then exit sub.. i'm thinking that this might be something that's not possible...
-
Sep 27th, 2001, 03:24 PM
#5
Member
-
Sep 27th, 2001, 03:30 PM
#6
PowerPoster
Originally posted by jsun9
i need it so it doesn't need a catch like if form1.visible = false then exit sub.. i'm thinking that this might be something that's not possible...
Why? It's not exit sub anyway, it's exit FOR (the loop)
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
|