"\n" at the end of a TextBox line displays as a small []

G

Guest

I have a windows forms application with a TextBox display. I use the
following code to display a line in the TextBox:

......
statusTextBox.AppendText(message + "\n");
.......

I just want the text box to insert a new line after the message, it does
insert the new line but the [] always appears in the text box.
How can I add a new line without displaying []??
Any help is appreciated.

Thanks,

Esper
 
R

Rad [Visual C# MVP]

I used "\r\n" instead of "\n" and it works.....

aesper said:
I have a windows forms application with a TextBox display. I use the
following code to display a line in the TextBox:

.....
statusTextBox.AppendText(message + "\n");
......

I just want the text box to insert a new line after the message, it does
insert the new line but the [] always appears in the text box.
How can I add a new line without displaying []??
Any help is appreciated.

Thanks,

Esper

Or better yet, Environment.Newline
 
R

Raymond Yuen

Apart from the solution given by Rad, the new line character in Windows
platform contains 0x0D and 0x0A.

Regards,
Raymond

Rad said:
I used "\r\n" instead of "\n" and it works.....

aesper said:
I have a windows forms application with a TextBox display. I use the
following code to display a line in the TextBox:

.....
statusTextBox.AppendText(message + "\n");
......

I just want the text box to insert a new line after the message, it does
insert the new line but the [] always appears in the text box.
How can I add a new line without displaying []??
Any help is appreciated.

Thanks,

Esper

Or better yet, Environment.Newline
 

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