0

I am trying to open two different forms depending on if I click yes or no from a message box. The code runs but both yes and no open the same form. Is it possible to open two different forms? My code is posted below.

Both open Form3 when clicked. Thanks mbrown686886

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox("Nickname?", MsgBoxStyle.YesNo)
'This code will open the Form3
If MsgBoxResult.Yes Then
Form3 = Nothing
Form3.Show()
'This code will open the Form9
ElseIf MsgBoxResult.No Then
Form9 = Nothing
Form9.Show()
End If
End Sub

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by mbrown686886
0
Dim myCoolMsgBox As DialogResult '// declare a message box.
        myCoolMsgBox = MessageBox.Show("Nickname?", Me.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question)

        Select Case myCoolMsgBox
            Case DialogResult.Yes
                MsgBox("You pressed Yes.")
            Case DialogResult.No
                MsgBox("You pressed No.")
        End Select
0
   Dim myCoolMsgBox As DialogResult '// declare a message box.
    myCoolMsgBox = MessageBox.Show("Nickname?", Me.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question)

   Select Case myCoolMsgBox
        Case DialogResult.Yes
            MsgBox("You pressed Yes.")
        Case DialogResult.No
            MsgBox("You pressed No.")
    End Select

This did the trick. I owe you one. Thanks a million. I will marked as solved.
mbrown686886

Edited by Dani: Fixed formatting

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.