I’m making this little program because I was bored and I ran across this problem. Kevin bacon never shows up, meaning that the ElseIf dialogResult.no doesn’t become true when i do click no.
Here’s my code:
Public Class Form1
Private Sub btnMessage_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnMessage.Click
MessageBox.Show("I like Kevin Bacon.", "Bacon", MessageBoxButtons.OK, MessageBoxIcon.Question)
If DialogResult.OK Then
MessageBox.Show("You like Kevin Bacon.", "Bacon", MessageBoxButtons.OK)
If DialogResult.OK Then
MessageBox.Show("We all like Kevin Bacon.", "Bacon", MessageBoxButtons.OK)
If DialogResult.OK Then
MessageBox.Show("They all like Kevin Bacon.", "Bacon", MessageBoxButtons.OK)
If DialogResult.OK Then
MessageBox.Show("Let's wait to see if Kevin Bacon will come to play.", "Bacon", MessageBoxButtons.YesNo)
If DialogResult.Yes Then
System.Threading.Thread.Sleep(9000)
MessageBox.Show("Kevin bacon didn't show up... :(", "No Bacon", MessageBoxButtons.OK)
ElseIf DialogResult.No Then
MessageBox.Show("Well too bad! Here's kevin bacon!", "Wild Bacon has appeared!", MessageBoxButtons.OK)
Form2.Show()
End If
End If
End If
End If
End If
End Sub
Private Sub btnStuff_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnStuff.Click
End Sub
End Class
You need declare a variable of type
DialogResultand assign the result of your MessageBox to it. What you are doing now is looking at theDialogResultof yourFormnot your `MessageBox’