vb.net 在 Visual Basic 中显示消息框

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35229470/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 19:42:47  来源:igfitidea点击:

Show message box in Visual Basic

vb.netif-statementvisual-studio-2012

提问by Gary Robinson

I currently have the following screen below:

我目前有以下屏幕:

I keep getting the error "End of statement expected" as shown below:

我不断收到错误“预期语句结束”,如下所示:

How should I end the statements to get this to work?

我应该如何结束语句以使其工作?

回答by Char2d2

This will run your code when either Radio Button is selected. I'd consider spending time looking at other questions or other sources for syntax help.

这将在选择任一单选按钮时运行您的代码。我会考虑花时间查看其他问题或其他资源以获得语法帮助。

Public Class Greetings
Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton1.CheckedChanged, RadioButton2.CheckedChanged

    If RadioButton1.Checked Then
        MessageBox.Show("Hello")
    ElseIf RadioButton2.Checked Then
        MessageBox.Show("Goodbye")
    End If

End Sub
End Class