设置msgbox的标题?

时间:2009-08-20 19:44:35

标签: vb.net winforms messagebox title

是否可以在vb.net中更改msgbox的标题?

1 个答案:

答案 0 :(得分:9)

是的,使用正确的重载version of Show()

Visual Basic (Usage)
Dim text As String
Dim caption As String
Dim buttons As MessageBoxButtons
Dim returnValue As DialogResult

returnValue = MessageBox.Show(text, caption, buttons)

从MSDN(Caption变量是MessageBox的标题):

Dim Message As String = "You did not enter a server name. Cancel this operation?"
Dim Caption As String = "Error Detected in Input"
Dim Buttons As MessageBoxButtons = MessageBoxButtons.YesNo

Dim Result As DialogResult

'Displays the MessageBox

Result = MessageBox.Show(Message, Caption, Buttons)