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;
  textBox1.ScrollToCaret();
}