Automatically Scroll to the Bottom of a Multiline TextBox

The requirement is pretty simple. There’s a multiline textbox which is getting updated at a fixed time interval. So I wan’t the focus inside the textbox (or you can say the cursor position) should always be on the last line. To do that write the following code in the TextChanged event of your textbox

private void textBox1_TextChanged(object sender, EventArgs e)
  textBox1.SelectionStart = textBox1.Text.Length;


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.