|
-
Jan 29th, 2000, 08:34 AM
#1
Thread Starter
Hyperactive Member
I know if the person clicks the x it is in the code form_unload but here is the thing when someone clicks the x it only kils that one form I want the rest to be killed too so I put unload all the forms under the form unload like this:
unload form1
but the thing is sometimes in the code i have it so the form unloads because of something else and when that happens it will kill them all when I don't want it to. I remember seeing something liek this maybe..
pirvate sub form_unload()
If vb?????? = true then
unload form1
end if
end sub
does anyone know how to do this?
then
------------------
Sincerely,
Chris
:-) ;-)
just have fun out there and live life to the fullest while it is still here
Email [email protected]
-
Jan 29th, 2000, 08:46 AM
#2
So Unbanned
in the form_unload put:
You may want to unload the other forms because using END does not always clear the forms from memory.
------------------
DiGiTaIErRoR
VB, QBasic, Iptscrae, HTML
Quote: There are no stupid questions, just stupid people.
-
Jan 29th, 2000, 08:51 AM
#3
Thread Starter
Hyperactive Member
I know end ends it. But in my code somewhere else I have this
private sub command1_click()
unload form1
form2.show
end sub
with that there it will end the program cause under the form_unload I had
unload form1
unload form2
unload form3
etc
see what i mean??
------------------
Sincerely,
Chris
:-) ;-)
just have fun out there and live life to the fullest while it is still here
Email [email protected]
-
Jan 29th, 2000, 09:26 AM
#4
Hyperactive Member
I think I got it. Basically, you can't, because the computer doesn't know if the user is clicking the X to get rid of the program, or clicking the X to get rid of the form. You could try making the main form invisible instead of unloading it.
-
Jan 30th, 2000, 01:31 AM
#5
It sounds like you should think about redesigning your project, but if you want a form to close only if the user click the "X", then use this as that form's QueryUnload event.
Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Select Case UnloadMode
Case vbFormControlMenu
' The user chose the Close command from the Control menu on the form
' Case vbFormCode
' ' The Unload statement is invoked from code.
' Case vbAppWindows
' ' The current Microsoft Windows operating environment session
' ' is ending.
' Case vbAppTaskManager
' ' The Microsoft Windows Task Manager is closing the application.
' Case vbFormMDIForm
' ' An MDI child form is closing because the MDI form is closing.
' vbFormOwner
' ' A form is closing because its owner is closing.
Case Else
Cancel = True
End Select
End Sub
What happens here is that when the user clicks the "X", UnloadMode equals vbFormControlMenu and VB allows the form to unload. Any other value for UnloadMode sets Cancel to True which stops the unload. I left in commented examples of all the other possible form-unload scenarios.
------------------
Marty
COGITO EGGO SUM
I think; therefore I am a waffle.
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
|