我正在浏览 200 个关于 VB 的短视频教程,在处理消息框的教程中,讲师要求我们尝试用一些 Else If 语句来响应更多按钮。我让它工作了,有点,除了我必须点击两次重试按钮才能工作,我必须点击忽略按钮三次才能工作。有人可以告诉我我做错了什么吗?我的代码如下。
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