textbox newline

J

john bailo

How do create a new line in a text box.

If I put \n in my string, and set .Text to the
value of the string, a carriage return character is displayed literally,
but it doesn't actually start on a new line in the textbox.
 
A

Alan Pretre

john bailo said:
How do create a new line in a text box.
If I put \n in my string, and set .Text to the
value of the string, a carriage return character is displayed literally,
but it doesn't actually start on a new line in the textbox.

Use \r\n.

-- Alan
 
E

Empire City

Where can you look up all those \r\n thingy me gigs in the in the
documentation?
 
J

john bailo

Bob Powell said:
If you do it programatically "Something\r\nWicked" it will show up as a
newline but not if you go through the designer. Also, ensure that you don't
have the @ (literal string) in front of it.

Bob Powell [MVP]
C#, System.Drawing

Thanks -- I left off the \r and just put in the \n

Now it works !!!

Thanks Bob.
 
B

Bob Powell [MVP]

all those \r\n thingy me gigs

Not many of them...

\\ literal backslash
\n literal newline
\r literal carriage return
\t literal horizontal tab
\v literal vertical tab
\" literal double-quote

\v is recognized but you can't use it in a text box.

--
Bob Powell [MVP]
C#, System.Drawing

September's edition of Well Formed is now available.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top