Appending text with newline in a textbox

R

Rein Petersen

Hi All,

I'm having a heckuva time trying to append lines into my multiline readonly
System.Windows.Forms.TextBox

I was expecting to simply do this:

myTextBox.Text += "appending this line \n";

but it doesn't append a newline at the end of my string. It justs adds a
little black box character at the end and new appends just continue as one
long line.... arg.

What am I doing wrong? I just want to echo messages to the form....

Rein
 
R

Rein Petersen

Fred Mellender said:
append Environment.NewLine. See class doc for same.

Thats it!!

myTextBox.Text += "some text to append and here comes the newline" +
Environment.Newline;


Rein
 
R

Rein Petersen

Thats what I would have thought. Of course I tried it and was completely
stymied when the character escapes ("\r\n") didn't produce a newline...
Maybe I used the wrong slashes (doubt it). I'll try it again later for good
measure and let everyone know result (don't want to misinform).

Rein
 
M

Miha Markic

I've tried with this:
textBox1.Text = "Tubo\r\nTubo";

(textBox1.Multiline should be True)
 

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