-
March 6th, 2002, 09:01 AM
#1
how to close all forms when closing the application?
I have a main form on my application and I want to close all forms when I exit the main dialog.
How can I do that?
private Sub closeAllForms()
Dim i as Integer
for i = 0 to Forms.Count - 1
If Forms(i).Name <> "Wnd_Main" then
' close form(i)??
End If
next
End Sub
-
March 6th, 2002, 09:25 AM
#2
Re: how to close all forms when closing the application?
I'm not to sure what you want to do here!.
Once the main Form is unloaded all other forms follow suit. Try using your code in the main Forms Unload QueryUnload Event
private Sub Form_QueryUnload(Cancel as Integer, UnloadMode as Integer)
Dim i as Integer
for i = 0 to Forms.Count - 1
If Forms(i).Name <> me.name then
'close form
unload (Forms(i))'(i)?? End If
next i
End Sub
Andrew Lennon (Berlitz)
Automation Dev Engineer
-
March 6th, 2002, 09:25 AM
#3
Re: how to close all forms when closing the application?
I'm not to sure what you want to do here!.
Once the main Form is unloaded all other forms follow suit. Try using your code in the main Forms Unload QueryUnload Event
private Sub Form_QueryUnload(Cancel as Integer, UnloadMode as Integer)
Dim i as Integer
for i = 0 to Forms.Count - 1
If Forms(i).Name <> me.name then
'close form
unload (Forms(i))'(i)?? End If
next i
End Sub
Don't forget to Rate !!!!
Andrew Lennon (Berlitz)
Automation Dev Engineer
-
March 6th, 2002, 11:05 AM
#4
Re: how to close all forms when closing the application?
Thanks, it works perfectly
-
March 6th, 2002, 11:13 AM
#5
Re: how to close all forms when closing the application?
Here is but another way to close all forms.
Set the code u=in the FOrm_Unload event or the QUeryUNload event
private Sub Form_QueryUnload(Cancel as Integer, UnloadMode as Integer)
Dim f as Form
for Each f In Forms
If f.Name <> me.Name then Unload f
next f
End Sub
Please rate it if it answers the question
or is useful.
'
John G
-
March 6th, 2002, 11:29 AM
#6
Re: how to close all forms when closing the application?
Use 'end' in place of any unload statement.It closes all the forms.
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
|