MsgBox Help
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
6 posts
Page 1 of 1
I am trying to use MsgBox to display a message with yes no boxes and then use the results from the user to decide the next action. I am having troubles left and right. 1st Option Strict is having fits about conversions and if i turn off option strict the program executes but the"No" Button doesn't do any thing at all. I have tried to dim answer as an Integer aswell but it doesnt work either. How do i correct this issue. My goal is to have the user recieve the MsgBox ata certain point and then based on their decision (Yes or No)have the program repeat or not.
Any help would be appreciated.
Here is a sample of the code.
Any help would be appreciated.
Here is a sample of the code.
Code: Select all
Dim answer As MsgBoxResult
MsgBox("Congrats yadda yadda.",MsgBoxStyle.YesNo,"MsgBoxTitle.")
If MsgBoxResult.Yes Then
Yadda Yadda Whole Lot Of Code yadda yadda
Else
Default Msg
EndIf
Continue with Program
Continue with Program
Continue with Program
Continue with Program
Hello,
this should work;
this should work;
Code: Select all
Dim dr As New DialogResult
dr = MsgBox("Question", MsgBoxStyle.YesNo, "Title")
If dr = Windows.Forms.DialogResult.Yes Then
'Do something
Else
Exit Sub
End If
CodenStuff wrote:Nope, it's just your sick and dirty mind. You sick twisted warped little pervo![]()
visioncr0 wrote:Hello,Actually, I don't think that would work, as MsgBox is a legacy control from VB6. Instead, you should use Messagebox.Show, like so:
this should work;
Code: Select allDim dr As New DialogResult dr = MsgBox("Question", MsgBoxStyle.YesNo, "Title") If dr = Windows.Forms.DialogResult.Yes Then 'Do something Else Exit Sub End If
Code: Select all
Dim result As Windows.Forms.DialogResult= MessageBox.Show("Message", "Title",Buttons, icon)
Select Case Result
Case Is= Windows.Forms.DialogResult.Yes
'Do something
Case Is=Windows.Forms.DialogResult.No
'Do something else
End Select
None of the above works :lol:
Code: Select all
Dim result As Windows.Forms.DialogResult = MessageBox.Show("Message", "Title", MessageBoxButtons.YesNo)
If result = DialogResult.Yes Then
'Yes'
Else
'No'
End If
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!
![Image]()
![Image]()
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!

MrAksel wrote:None of the above works :lol:It's almost the same, and my code works (I tested it)Code: Select allDim result As Windows.Forms.DialogResult = MessageBox.Show("Message", "Title", MessageBoxButtons.YesNo) If result = DialogResult.Yes Then 'Yes' Else 'No' End If
CodenStuff wrote:Nope, it's just your sick and dirty mind. You sick twisted warped little pervo![]()
I thought the "New" in "Dim dr As New DialogResult" would generate a compiler error, but sorry 

LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!
![Image]()
![Image]()
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!

6 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023