?
Solved

VB YES NO CANCEL - VB.NET Visual studio 2003 Message box

Posted on 2006-05-11
4
Medium Priority
?
946 Views
Last Modified: 2008-01-09
I bulding a windows application using visual studio 2003. Vb.net

I want to show a messagebox with yes no and cancel button on it.

messagebox.show("Message",    ------------ )

also let me know, how to grab the output of the selection made from the messagebox.

please help me in this simple question.

Thanks
0
Comment
Question by:Apu_Shah
4 Comments
 
LVL 17

Accepted Solution

by:
ZeonFlash earned 1000 total points
ID: 16664502
Dim dlgResult As DialogResult

dlgResult = MessageBox.Show("Message", "Caption here", MessageBoxButtons.YesNoCancel)

Select Case dlgResult
     Case DialogResult.Yes
           'Yes code here
     Case DialogResult.No
           'No code here
     Case DialogResult.Cancel
           'Cancel code here
End Select
0
 
LVL 3

Expert Comment

by:snow_moon
ID: 16664510
Dim intResult As Integer
        intResult = MessageBox.Show("Message", "My Caption", MessageBoxButtons.YesNoCancel)

        Select Case intResult
            Case DialogResult.Yes
                ......
            Case DialogResult.No
                ......
            Case DialogResult.Cancel
                ......

        End Select
0
 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 16664534
This should do it

       Dim Message As String = "Message"
        Dim Caption As String = "Error Caption"
        Dim Buttons As MessageBoxButtons = MessageBoxButtons.YesNoCancel

        Dim Result As DialogResult

        'Displays the MessageBox

        Result = MessageBox.Show(Message, Caption, Buttons)

        ' get the user selection

        If Result = Windows.Forms.DialogResult.Yes Then
         'Or Result=Windows.Forms.DialogResult.No
         'Or Result=Windows.Forms.DialogResult.Cancel

            ' Do something
           
        End If
0
 
LVL 2

Author Comment

by:Apu_Shah
ID: 16664574
Thanks all,

All answers are correct.

ZeonFlash response time was good enough to get him points.

Thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question