Link to home
Start Free TrialLog in
Avatar of Apu_Shah
Apu_Shah

asked on

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

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
ASKER CERTIFIED SOLUTION
Avatar of ZeonFlash
ZeonFlash

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of snow_moon
snow_moon

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
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
Avatar of Apu_Shah

ASKER

Thanks all,

All answers are correct.

ZeonFlash response time was good enough to get him points.

Thanks