21

Possible Duplicate:
How do I automatically scroll to the bottom of a multiline text box?

I use a multiline TextBox to output some information in new lines as it arrives from a BackgroundWorker.

Can I make it to scroll to the very bottom each time a new line arrives?

By default it seems to do just the opposite - it scrolls to the very first line each time a new line arrives and the Text property is changed.

Community
  • 1
  • 1
Ivan
  • 63,011
  • 101
  • 250
  • 382

1 Answers1

53

Set the TextBox properties:

Multiline = True;
ScrollBars = Both;

To auto scroll on the TextChanged event:

textBox1.SelectionStart = textBox1.Text.Length;
textBox1.ScrollToCaret();
Francesco B.
  • 2,729
  • 4
  • 25
  • 37
Patrick Guimalan
  • 990
  • 9
  • 11