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?
Printable View
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?
If MsgBox("Ask A Question", vbYesNo + vbQuestion) = vbYes then
'Code for Yes
else
'Code for No
End If
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
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