|
-
Jun 10th, 2001, 12:45 AM
#1
Thread Starter
Fanatic Member
not unloading my app if Cancel is picked
?
how do i do this?
if the user clicks the big 'X' in the upper right corner, i want to ask if they want to close.
if yes unload me
else
'what here?
end if
i have no clue so any suggestions would be super cool.
thanks
-
Jun 10th, 2001, 12:59 AM
#2
Hyperactive Member
I THINK THIS SHOULD WORK..
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
prompt$ = "ARE YOU SURE YOU WANT TO EXIT?"
reply = MsgBox(prompt$, vbYesNo, "EXIT")
If reply = vbYes Then
Unload Me
Else
Cancel = True
End If
End Sub
-
Jun 10th, 2001, 12:59 AM
#3
Addicted Member
Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode = 1 Then
X = MsgBox("Are you sure you want to exit?", vbYesNo)
If X = vbYes Then
' Unload Code Here
Else
Cancel = 1
End if
Else
' OS Is forcing close, put forced exit code here
End If
End Sub
Last edited by bbosh; Jun 10th, 2001 at 01:14 AM.
Brian
Programming: VB5 Pro (SP3) - QBasic 1.1,4.5
Internet: HTML 4, CSS, JavaScript
Visit AltInt.com!
-
Jun 10th, 2001, 12:59 AM
#4
Lively Member
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If MsgBox("Do really want to quit?", vbQuestion Or vbYesNo, "Quit?") = vbNo Then
Cancel = 1
End If
End Sub
-
Jun 10th, 2001, 02:18 AM
#5
Registered User
Query Unload event details:
Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Select Case UnloadMode
Case vbFormControlMenu ' =0 closed by user
Case vbFormCode ' =1 form closed by code
Case vbAppWindows ' =2 windows is ending
Case vbAppTaskManager ' =3 task manager is closing
Case vbFormMDIForm ' =4 mdi parent is closing
Case vbFormOwner ' =5 the owner form is closing
End Select
End Sub
-
Jun 10th, 2001, 10:45 AM
#6
Thread Starter
Fanatic Member
-
Jun 10th, 2001, 01:09 PM
#7
Addicted Member
What do I have to do for making the "No" or "cancel" button as the default button ?
-
Jun 10th, 2001, 01:56 PM
#8
Addicted Member
X = Msgbox("Are you sure you want to exit?", vbyesnocancel or vbdefaultbutton2) ' No is default
X = Msgbox("Are you sure you want to exit?", vbyesnocancel or vbdefaultbutton3) ' Cancel is default
Brian
Programming: VB5 Pro (SP3) - QBasic 1.1,4.5
Internet: HTML 4, CSS, JavaScript
Visit AltInt.com!
-
Jun 10th, 2001, 02:15 PM
#9
Addicted Member
Thanks !!
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
|