Hi,
Could someone help me to append text to a text box so that it is added to new line into the text box. Text box's multiline property is set to true.
Thanx in advance
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sukhbir DalalPosted Aug 25, 2006, 12:18 AM
Thanx for ur comments.
I got that by inserting the special characters "\r\n" after the text.
SolitairePosted Aug 24, 2006, 6:23 PM
In Visual Basic, concatenate vbCrLf to the string:
Textbox1.Text = Textbox1.Text & vbCrLf & "Second line" & vbCrLf & "Another new line"
Alternatively, you can use
Environment.New Line for both VB and C#:
TextBox1.Text = TextBox1.Text & Environment.NewLine & "Second Line" & Environment.NewLine & "Third Line"
textBox1.Text = textBox1.Text + Environment.NewLine + "Second Line"
+
Environment.NewLine + "Third Line";