CARRIAGE RETURN - LINE FEED

  • Thread starter Thread starter Rob H.
  • Start date Start date
R

Rob H.

How do you put a carriage return and/or a linefeed in a
string. I am actually putting several line of text in a
Label but I need some blank lines in the middle of the
label.
Thanks for any help.
 
Hi,

In VB it would be something like:

MyString & vbCrLf

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
 
I am using C#. I have tried using \r\n ("blah \r\n blah")
but it did not insert a blank line when I ran the program.
Thanks.
 
Look at using Environment.NewLine

Example: string strText = "This is a " + Environment.NewLine +
Environment.NewLine + "test";
 
Not in the Compact rameWork

Brian Piesik said:
Look at using Environment.NewLine

Example: string strText = "This is a " + Environment.NewLine +
Environment.NewLine + "test";
 
Ok, I have slept and the magic fairy has made my code work
now. For some reason, today all is working well. Don't I
wish that would happen every morning. Anyway, "blah \n\r
blah" works like a charm (using C# .NETCF). Thanks to all
that helped me out.
 
It's supposed to be \r\n
To help remember it imagine how the typewriter operates (right, like people
actually use them <g>)
When you are going to the next line it's Carriage Return (\r) followed by
New Line (\n), not the other way around
 
Back
Top