|
-
Nov 25th, 2005, 04:53 PM
#1
Thread Starter
Junior Member
Cancel Unload
Here's what I've got
VB Code:
Private Sub Form_Unload(Cancel As Integer)
Cancel = True
End Sub
Problem is, it closes any child forms even though it doesn't close the main form.
Is there a solution?
cory
-
Nov 25th, 2005, 04:57 PM
#2
Re: Cancel Unload
Try setting Cancel = True in the form's QueryUnload event instead.
Pete
No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.
-
Nov 25th, 2005, 05:05 PM
#3
Re: Cancel Unload
What pnish said will work but you will have to do some 'IFing' or it will be impossible to close the application if you do only that.
-
Nov 25th, 2005, 06:14 PM
#4
Fanatic Member
Re: Cancel Unload
Welcome to the forums...
try this...
VB Code:
Private Sub Form_Unload(Cancel As Integer)
Cancel = 1 'Change True to 1
End Sub
Last edited by modpluz; Nov 25th, 2005 at 06:23 PM.
-
Nov 25th, 2005, 06:25 PM
#5
Re: Cancel Unload
 Originally Posted by modpluz
try this...
VB Code:
Private Sub Form_Unload(Cancel As Integer)
Cancel = 1 'Change True to 1
End Sub
Cancel can be any non-zero value. So Cancel = 1 will work exactly the same as Cancel = True (True = -1). If you wanted you could make Cancel = 12345 and it would work.
As I posted earlier, the solution is move the code to the QueryUnload event.
Pete
No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.
-
Nov 26th, 2005, 12:06 PM
#6
Thread Starter
Junior Member
Re: Cancel Unload
Hey Guys,
Thanks for the help. It works great. I didn't even notice the QueryUnload event.
Thanks again,
Cory
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
|