|
-
Jun 23rd, 2001, 08:05 PM
#1
Thread Starter
Addicted Member
Yes or No answer...
In my program, I want a message box to appear, when the user hits "Exit". I have the message box, it asks if they are sure they want to quit. (Yes or No option) Here is the code of the message box:
MsgBox "Are you sure you want to quit?", _
vbQuestion + vbYesNo, _
"Do you qant to quit?"
The message box isnt the problem, its the answer. How do I make it so on Yes, it closes, and on No, it doesnt? I'd imagine it may be some kind of "if" statement but im not sure. Please responde if you may know!
-
Jun 23rd, 2001, 08:07 PM
#2
Thread Starter
Addicted Member
Error in the code i gave...
MsgBox "Are you sure you want to quit?", _
vbQuestion + vbYesNo, _
"Do you qant to quit?"
Was the code i gave, there is a spelling error. It should read:
MsgBox "Are you sure you want to quit?", _
vbQuestion + vbYesNo, _
"Do you want to quit?"
Thats want, not qant! Sorry!
-
Jun 23rd, 2001, 08:08 PM
#3
Member
heres how you do it!
response = Msgbox("Are you sure you want to quit?",vbquestion + vbyesno,"Do you want to quit?")
if response = vbyes then
end
elseif response = vbno then
exit sub
end if
there it is!
-
Jun 23rd, 2001, 08:12 PM
#4
-= B u g S l a y e r =-
Dim iRes As Integer
iRes = MsgBox("Quit?", vbYesNo + vbQuestion)
If iRes = vbYes Then End
peet
-
Jun 23rd, 2001, 08:16 PM
#5
Thread Starter
Addicted Member
It didnt work...
That code, caused it only to close the message window, upon yes or no! i copied it and psted it, so there was no problem in writing it.
-
Jun 23rd, 2001, 08:18 PM
#6
Member
whose code doesnt work?
i'm sure my code works.
response = Msgbox("Are you sure you want to quit?",vbquestion + vbyesno,"Do you want to quit?")
if response = vbyes then
end
elseif response = vbno then
exit sub
end if
cya
-
Jun 23rd, 2001, 08:23 PM
#7
-= B u g S l a y e r =-
hmm this works just fine....
Dim iRes As Integer
iRes = MsgBox("Quit?", vbYesNo + vbQuestion)
If iRes = vbYes Then End
peet
-
Jun 23rd, 2001, 08:27 PM
#8
Thread Starter
Addicted Member
peet's worked...
Peet's code worked fine. The otherone didnt!:P
-
Jun 23rd, 2001, 08:30 PM
#9
-= B u g S l a y e r =-
hmm ...
bizzyVB's should work as well...
-
Jun 23rd, 2001, 08:45 PM
#10
Addicted Member
Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Dim mres As VbMsgBoxResult
mres = MsgBox("Are you sure you want to quit?", vbYesNoCancel Or vbExclamation, "My Application")
Select Case mres
Case vbYes
'User wants to save file
Save_File
Case vbNo
'Program ends, no save.
Cancel = False
Case vbCancel
'Cancel the exit, app stays running.
Cancel = True
End Select
End Sub
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
|