Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I scroll a RichTextBox to the bottom?

I need to be able to scroll a RichTextBox to the bottom, even when I am not appending text. I know I can append text, and then use that to set the selection start. However I want to ensure it is at the bottom for visual reasons, so I am not adding any text.

like image 472
Very Very Cherry Avatar asked May 21 '09 22:05

Very Very Cherry


People also ask

How to auto scroll RichTextBox in c#?

Re: C# Richtextbox Autoscrolling to bottomChange your invoke action to call a method in the main thread. Pass the string to append to the method. Use the RickTextBox. AppendText method instead of .

What is RichTextBox control in C#?

In C#, RichTextBox control is a textbox which gives you rich text editing controls and advanced formatting features also includes a loading rich text format (RTF) files. Or in other words, RichTextBox controls allows you to display or edit flow content, including paragraphs, images, tables, etc.


1 Answers

You could try setting the SelectionStart property to the length of the text and then call the ScrollToCaret method.

richTextBox.SelectionStart = richTextBox.Text.Length; richTextBox.ScrollToCaret(); 
like image 113
Brandon Avatar answered Sep 30 '22 14:09

Brandon