![]() |
I got a problem. Im confused on how to manipulate a MessageBox using an IF statment. I need it to close the program when I hit Cancel button and to run a SaveDialogBox when I hit OK. Just cant figure it out. Thanks.
|
Here is the code I have now:
:
Private Sub mnuExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuExit.Click |
I suggest using YesNoCancel, where Yes saves and exits, No just exits, and Cancel stops the app from exiting.
Now, I'm not 100% sure in VB .NET, but in VB6, you need to get the return value from the message box and test it for vbYes, vbNo or vbCancel: :
Dim retVal as IntegerThat should do it. |
Quote:
I wasn't aware of the whole retVal concept. Now I am. O_O |
Glad I could help. And unlike most of my code, I think that's bug-free as well.
|
Quote:
I wasn't aware of the whole retVal concept. Now I am. O_O [/b][/quote] You could just do it :
If MsgBox("Question", vbOKCancel, "Title") = vbOK Then:) |
But then you can't use Yes, No and Cancel...
|
Message Box
What about:
:
Select Case MsgBox("Do you want to lay off all your employees, Bill?", vbExclamation + vbYesNoCancel, "Microsoft Corporation") |
Stop dragging up old posts already.
|
| All times are GMT -5. The time now is 2:32 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC