"\n" appearing as text in textboxes

S

Sathyaish

What's with these newline characters and textboxes. I've noticed this
in .NET and it wasn't prevelant in Visual Studio 6.0.

Unless you have a richtext box, which displays the text representation
of the newline character as it reads on paper, the ordinary text box
displays the character representation instead.

Why? Is there a way to turn it off in an ordinary text box?
 
M

Morten Wennevik

Hi Sathyaish,

\n is not a valid character for new lines on windows systems, although
most controls accept \n as new line, you really should use \r\n or
System.Environment.Newline as some controls (like TextBox) does not accept
just \n
 
K

Kim

Havent seen nor needed this myself, but could it be that you dont have
set the property "Multiline" to true ?

If that doesnt work, you could use the String.Replace() method, by
replacing "\n" with "".

Sathyaish skrev:
 

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