0

I have a Created a logwindow in my project in C#

enter image description here

This log window is nothing but a richtexbox. I am appending the lines in RichTextbox whenever a method is called.

What i want is : It should autoscroll down whenever a new line is Appended in the rich text box.

Can anybody tell me how to do it.

thanks

GameBuilder
  • 1,169
  • 4
  • 31
  • 62
  • Possible duplicate of [Rich Text box scroll to the bottom when new data is written to it](http://stackoverflow.com/questions/9416608/rich-text-box-scroll-to-the-bottom-when-new-data-is-written-to-it) – Equalsk Feb 05 '16 at 11:38

1 Answers1

1

Basically you just have to set the "cursor" to the end of the box by setting the SelectionStart and afterwards tell the control to scroll to the caret (= the selection):

rtfBox.SelectionStart = rtfBox.Text.Length;
rtfBox.ScrollToCaret();
Waescher
  • 5,361
  • 3
  • 34
  • 51