[英]How to Change Grouping of Radio Buttons in Visual Basic 2010 Express Edition
[英]How to change buttons on a msgbox using a combo box in visual basic 2010 express?
我想显示一个包含组合框提供的信息的msgbox 。 具体来说,如果组合框包含“警告”,则希望msgbox显示警告图标。
基本上,我需要知道如何将组合框的输入放入msgbox,而不必使其具有MsgBoxStyle.Critical
或类似的东西。
我认为可行:
Private Sub Button1_Click(ByVal sender As system.object, ByVal e As System.EventArgs) Handles Button1.Click
If ComboBox1.SelectedItem = "Warning" Then
ComboOutput = Msgboxstyle.critical
希望我的问题很清楚。
以下应该工作:
我们在表单加载时加载所有枚举值。 然后单击,我们解析名称并显示消息框。
Private Sub Form5_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
ComboBox1.DataSource = [Enum].GetNames(GetType(MessageBoxIcon))
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim value = [Enum].Parse(GetType(MessageBoxIcon), CStr(ComboBox1.SelectedItem))
MessageBox.Show("Text", "Caption", MessageBoxButtons.OK, CType(value, MessageBoxIcon))
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.