设置msgbox的标题?

l--*_*''' 2 vb.net messagebox title winforms

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

i_a*_*orf 9

是的,使用正确的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)
Run Code Online (Sandbox Code Playgroud)

从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)
Run Code Online (Sandbox Code Playgroud)

  • 是的,我在上面的括号中说过.:) (4认同)
  • 如果不清楚,"标题"是框的标题. (2认同)