RE: Line break in a windows application

From: Richard (Richard_at_discussions.microsoft.com)
Date: 08/13/04


Date: Fri, 13 Aug 2004 13:55:01 -0700

What happens when you do this?:

this.TextBox1.AppendText("Hello"+Environment.NewLine+"World");

"Nurchi BECHED" wrote:

> 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.
>
>
>