我正在通过200个关于VB的短视频教程和处理消息框的教程,教师要求我们试着用一些其他的方法来响应更多的按钮如果声明。我得到它的工作,有点,除了我必须点击两次重试按钮之前,它将工作,我必须点击忽略按钮三次才会工作。有人能告诉我我做错了什么吗?我的代码如下。在按钮上点击多个按钮
Private Sub btnShowMsg_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowMsg.Click
If MessageBox.Show("Click Something", "Make a Selection", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Abort Then
MessageBox.Show("Hey, you Aborted me!")
ElseIf MessageBox.Show("Click Something", "Make a Selection", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Retry Then
MessageBox.Show("You are trying to retry, aren't you?")
ElseIf MessageBox.Show("Click Something", "Make a Selection", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Ignore Then
MessageBox.Show("Don't you dare ignore me!!")
End If
End Sub
你应该学会如何使用调试器来发现这样的问题:-) – sloth