How to add a newline in a MessagBox

  • Thread starter Thread starter tiger79
  • Start date Start date
T

tiger79

Hi,
is it possible to add newlines in a Messagebox ??? I'm used to consolles
(and c++) where u could use /n.
Is there something like that to use in messagBox ?
Thanx
 
hhmmm... so something like :

MessageBox.Show("Hello there"\n"Evrything fine ???")
or do I have to place some +es like in +\n+ ?
 
Newline constant is "\r\n" (Carriage Return and Linefeed) e.g.

[C#]
MessageBox.Show("Hello there\r\nEverything fine ???");

[VB]
MessageBox.Show("Hello there" + vbCrLf + "Everything fine ???")

If you are using the OpenNETCF Smart Device Framework you can also use the
EnvironmentEx.NewLine constant.

HTH

Peter
 
Just to clarify - "\r\n" is a C# (or C/C++, JavaScript) escape sequence,
which has no meaning in other languages. It translates into a combination of
characters with codes 13 and 10. Visual Basic does not define escape
sequences but instead uses constants vbCr = Chr(13), vbLf = Chr(10), vbCrLf
is a combination of the above.

--
Alex Feinman
---
Visit http://www.opennetcf.org
Peter Foot said:
Newline constant is "\r\n" (Carriage Return and Linefeed) e.g.

[C#]
MessageBox.Show("Hello there\r\nEverything fine ???");

[VB]
MessageBox.Show("Hello there" + vbCrLf + "Everything fine ???")

If you are using the OpenNETCF Smart Device Framework you can also use the
EnvironmentEx.NewLine constant.

HTH

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

tiger79 said:
hhmmm... so something like :

MessageBox.Show("Hello there"\n"Evrything fine ???")
or do I have to place some +es like in +\n+ ?
 
I think some other control (textBox?) had a problem with just LF, so I
usually put CRLF to be on the safe side

--
Alex Feinman
---
Visit http://www.opennetcf.org
Neil Cowburn said:
Actually, just \n works fine in the message box.


Newline constant is "\r\n" (Carriage Return and Linefeed) e.g.

[C#]
MessageBox.Show("Hello there\r\nEverything fine ???");

[VB]
MessageBox.Show("Hello there" + vbCrLf + "Everything fine ???")

If you are using the OpenNETCF Smart Device Framework you can also use the
EnvironmentEx.NewLine constant.

HTH

Peter
 
thanx for the (many) answers...
I tired with /n and it works fine... If I ever get a problem then I know I
should place an extra /r ;)
 
Back
Top