我想在messageBox上显示一个带有comboBox显示的messageBox并返回comboBox结果。但我不知道如何在messageBox中添加一个comboBox inisde。我使用visual studio,编程语言是vb.net。有人可以帮忙吗? 我想要的messageBox是MessageBox.Show(),而不是MsgBox() 谢谢你的帮助~~
答案 0 :(得分:1)
使用自定义表单而不是.ShowDialog()
方法。你可能不得不以某种方式覆盖DialogResult
枚举,尽管我认为只要将你需要的东西传回去就可能更简单。
更新:
如果组合框提供整数值,如果将DialogResult设置为自定义表单中的整数,则可以执行类似的操作。 FYI ShowMsg
是我的重载函数,它将根据发送的参数显示我的自定义表单。
Dim Result As DialogResult = _
ShowMsg("Select from the combobox", "Select an integer", ShowMsgButtons.OK, ShowMsgImage.Exclmation, ShowMsgDefaultButton.Button1)
Select Case Result
Case 10
'what happens when they select 10 from the combobox
Case 20
'what happens when they select 20 from the combobox
Case 30
'what happens when they select 30 from the combobox
End Select