|
-
May 20th, 2001, 02:21 AM
#1
Halt QueryUnload Event
During the QueryUnload event I want to *stop* VB from shutting down the program.
For example. The user clicks the corner 'X'. During the QueryUnload event I prompt the user with a YesNoCancel MsgBox. If the user hit's cancel I need to stop the QueryUnload event from actually shutting down the application.
Any thoughts on how I can do this?
--Lyle E. Dodge
[email protected]
-
May 20th, 2001, 05:14 AM
#2
Re: Halt QueryUnload Event
Try this:
Dim strReply As String
strReply = MsgBox("End?", vbYesNo)
If strReply = vbNo Then 'User clicks no
Cancel = True 'Dont end program
Else
Cancel = False 'End Program
End If
Cheers
Rob
-
May 20th, 2001, 02:49 PM
#3
Re: Halt QueryUnload Event
Rob,
Beautiful! Thanks so much. I've been coding for years and figured I could nail this one so I was getting frustrated.
In fact I was using Cancel = True elsewhere in the QueryUnload event but I was turning it False based on other conditions but I didn't realize that would affect the Event stopping or not.
Anyhow. I *really* appreciate your tips. Worked perfectly, as you expected.
--Lyle E. Dodge
[email protected]
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
|