Alex Gordon
Alex Gordon

Reputation: 60902

setting title of msgbox?

is it possible to change the title of the msgbox in vb.net?

Upvotes: 2

Views: 26587

Answers (1)

i_am_jorf
i_am_jorf

Reputation: 54640

Yes, use the right overloaded 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)

From MSDN (the Caption variable is the title of the 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)

Upvotes: 11

Related Questions