athgap
athgap

Reputation: 165

C# scrolling of richtextbox

Is there a method to scroll the richtextbox to the top automatically with codes? Thanks!

Upvotes: 1

Views: 3099

Answers (3)

Jerry Abraham
Jerry Abraham

Reputation: 1039

richTextBox.SelectionStart = richTextBox.Text.Length;
richTextBox.ScrollToCaret();

tRY the above 2 lines of code it worked for me!

Upvotes: 0

Kamran Khan
Kamran Khan

Reputation: 9986

Set .SelectionStart=0 and then .ScrollToCaret().

Upvotes: 6

JDPeckham
JDPeckham

Reputation: 2524

you mean bottom?

instance.SelectionStart = instance.Text.Length;

or i guess top would be instance.SelectionStart = 0.

Upvotes: 2

Related Questions