Code Comments
Programming Forum and web based access to our favorite programming groups.Hello, All!
I have created an application with a multiline textbox on the form.
When I press a button, it has to show something and then break
the line and show something else.
I tried "\n", ((char)13) and ((char)10) - they don't work.
When I enter a break by hand (just press enter) and run through
each character in that string, the line break character has code
13 10 (yes, 2 numbers for some reason)
The possible reason is that 'Enter' is a "control" key (a char with
ASCII code less than 32) - they usually return 2 numbers...
What should I do to break line in the textbox?
Alternative way was to use TextWriter:
string LineBreak=(new System.IO.StringWriter()).NewLine;
but there must be another way of doing it...
and then just use that string:
this.TextBox1.AppendText("Hello"+LineBreak+"World");
That is kind of stupid...
With best regards, Nurchi BECHED.
Post Follow-up to this messagequote:Windows line breaks *are* two characters. A linebreak on windows is \n\r -- a linebreak followed by a carriage return (13 10 in decimal). So, what you see is normal. This should help you with generating linebreaks for windows users, but be ca reful. Each of the major platforms handles linebreaks differently: WINDOWS: \n\r UNIX: \n MACINTOSH: \r I leave it up to you to figure out how to decide which type of linebreak to generate. Cheers, taylor
Originally posted by Nurchi BECHED Hello, All! When I enter a break by hand (just press enter) and run through each character in that string, the line break character has code 13 10 (yes, 2 numbers for some reason) The possible reason is that 'Enter' is a "control" key (a char with ASCII code less than 32) - they usually return 2 numbers...
Post Follow-up to this messageThu, 19 Aug 2004 14:38:12 -0500
tbarstow <tbarstow.1bbz5u@mail.codecomments.com> schrieb:
[Schnipp]
>Windows line breaks *are* two characters. A linebreak on windows is
>\n\r -- a linebreak followed by a carriage return (13 10 in decimal).
Small nitpick, carriage return ('\r') followed by a linefeed ('\n').
--
Jan v/d Broek
balglaas@xs4all.nl
"Geef je over, wy zyn Bassie en Adriaan, weerstand is nutteloos"
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.