Appending text with newline in a textbox

  • Thread starter Thread starter Rein Petersen
  • Start date Start date
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
 
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
 
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
 
I've tried with this:
textBox1.Text = "Tubo\r\nTubo";

(textBox1.Multiline should be True)
 
Back
Top