"\n" appearing as text in textboxes

  • Thread starter Thread starter Sathyaish
  • Start date Start date
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?
 
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
 
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:
 
Back
Top