all groups > dotnet windows forms > february 2008 >
You're in the

dotnet windows forms

group:

newlines in textbox


newlines in textbox tshad
2/13/2008 10:28:59 AM
dotnet windows forms:
I am using a TextBox as my status display and "\n" doesn't work.

What would I use to go to the next line in a TextBox.

I am doing something like:

Status.Text += String.Format("Opening
{0}\n",Path.GetFileName(strFile));

But the next line just continues on the same line.

Thanks,

Tom

Re: newlines in textbox tshad
2/13/2008 11:12:39 AM

[quoted text, click to view]

That was already set.

My problem wasn't going to multiple lines. But when I did something like:

Status.Text = "line 1\n"
Status.Text = "line 2\n"

I would get:

line 1line 2.

Turns out I can use the Environment.Newline to get it to work. But I am
surprised that that the "\n" wouldn't work.

Thanks,

Tom

[quoted text, click to view]

Re: newlines in textbox Jack Jackson
2/13/2008 12:42:59 PM
On Wed, 13 Feb 2008 10:28:59 -0800, "tshad" <tshad@dslextreme.com>
[quoted text, click to view]

I believe you can use \r\n for cr/lf. You can also use
Environment.Newline:

Status.Text += String.Format("Opening {0}{1}", _
Path.GetFileName(strFile), _
Environment.NewLine)
Re: newlines in textbox Herfried K. Wagner [MVP]
2/13/2008 8:13:15 PM
"tshad" <tshad@dslextreme.com> schrieb:
[quoted text, click to view]

Make sure the textbox' 'Multiline' property is set to 'true'. In addition I
suggest to use "\r\n" as line separator (which is the common line separator
on Windows), or 'Environment.NewLine' if you are targeting different
operating systems using different line separator character sequences.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Re: newlines in textbox Teemu
2/13/2008 8:34:43 PM

"tshad" <tshad@dslextreme.com> kirjoitti viestissä
news:%23eIiE6mbIHA.4040@TK2MSFTNGP05.phx.gbl...
[quoted text, click to view]

Status.Multiline=True?

-Teemu
AddThis Social Bookmark Button