How to auto scroll to the bottom of a multiline TextBox in C# ?

2008-06-20


At least in .NET 2.0, the TextBox control doesn't have a property to let the TextBox automatically scroll to the bottom when it is set to multiline.

You have to write code like this:

textBox1.Text += "Test string \n"; textBox1.Update(); textBox1.SelectionStart = textBox1.Text.Length; textBox1.ScrollToCaret();
OR, you can use the following code:
textBox1.AppendText("This is a test string \n"); textBox1.SelectionStart = textBox1.Text.Length; textBox1.ScrollToCaret();