Breaking Message Box Messages over several lines for formating - easy question I hope!

  • Thread starter Thread starter Patrick
  • Start date Start date
P

Patrick

Hello - I am wondering what the command is for breaking quoted text over
multiple lines for formatting in my code. An example is

MessageBox.Show("You Fool! The number of registrants cannot be 0. Please
re-enter the number of registrants.", _
"Input Error", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)

I would like to break the text box so it can all be viewed on the coding
screen or when the text is too much - description labels and such, as
bellow, of course, below doesn't work:

MessageBox.Show("You Fool! The number of registrants cannot be 0. _
Please re-enter the number of registrants.", "Input Error",
MessageBoxButtons.OK, _
MessageBoxIcon.Asterisk)

I really can't find an answer on how to do this. Any help would be
appreciated, and thanks!
 
You may append the VB.NET new line constant like this:

MessageBox.Show("First Line" & vbCrLf & "SecondLine")

Or you can append the .NET new line constant like this:

MessageBox.Show("FirstLine" & Environment.NewLine & "SecondLine")


--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com
 
Patrick said:
Hello - I am wondering what the command is for breaking quoted text over
multiple lines for formatting in my code. An example is

MessageBox.Show("You Fool! The number of registrants cannot be 0. Please
re-enter the number of registrants.", _
"Input Error", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)

I would like to break the text box so it can all be viewed on the coding
screen or when the text is too much - description labels and such, as
bellow, of course, below doesn't work:

MessageBox.Show("You Fool! The number of registrants cannot be 0. _
Please re-enter the number of registrants.", "Input Error",

\\\
.... be 0." & _
"Please...
///

.... or, if you want a new line in the message box:

\\\
.... be 0." & ControlChars.NewLine & _
"Please...
///
 
Back
Top