Click to See Complete Forum and Search --> : msgBox


Alexandre
June 5th, 2000, 08:24 AM
I use a msgBox vbYesNo before i close the form.
What can i do to do the difference between if the user press yes or no?

TH1
June 5th, 2000, 08:28 AM
If MsgBox("Ask A Question", vbYesNo + vbQuestion) = vbYes then
'Code for Yes
else
'Code for No
End If

Rob@SYPTE
June 5th, 2000, 08:28 AM
use the following

Dim Reply as string

Reply = msgbox("Are you sure?", vbyesno)

If Reply = vbyes then

End 'exit program

End If

Hope this helps

Rob

Nanobert
June 5th, 2000, 01:00 PM
You have to use a variable dedicated to the msgBox if you want to react.You should use the values.6 is standard for "Yes" and 7 is standard for "no".With this piece of code your programm should work (pleas put it in one line):
If msgBox("[enter your message here]", vb_yesno, "[Title]") = 6 then ... [if he chose "yes"] else ... [if he chose "no"]

for example:
If msgBox("Do you want to quit?", vb_yesno, "Quit?") = 6 then unload me

In this case the programm ends if he chooses "yes"
If he choses "no", nothing will happen!

I hope this helps you! Bye, Nanobert