Insert a line break into textbox

G

Guest

Dear all,

Is it possible to insert a line break into a textbox that the 'Multiline'
has been set to True? I used "\n" in C# but it doesn't work.

Thanks for any help,

Tedmond
 
J

Jeff Gaines

Dear all,

Is it possible to insert a line break into a textbox that the 'Multiline'
has been set to True? I used "\n" in C# but it doesn't work.

It should be - but isn't \n Unix?

Use Environment.Newline which I *think* will give you \n\r.
 
B

Bob Powell [MVP]

"\r\n" in the string will cause a linebreeak. This only works in code
however because if you do it in design-time the editor causes the '\'
characters to be escaped and they look like "hello\r\nWorld" in the runtime.

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

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

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

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
H

Herfried K. Wagner [MVP]

Jeff Gaines said:
It should be - but isn't \n Unix?

Use Environment.Newline which I *think* will give you \n\r.

.... on Windows-based systems.
 
K

Kevin Spencer

Actually, "\r\n" (on Windows systems)

--
HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP
 

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