Showing posts with label scroll to bottom in a textbox in C#. Show all posts
Showing posts with label scroll to bottom in a textbox in C#. Show all posts

Friday, April 8, 2011

How to scroll to bottom in a textbox in C#

Use function called ScrollToCaret of textbox. You need to first set the caret position to the end of the text box, then call the ScrollToCaret function.
Here's how to do it:
        //move the caret to the end of the text
        textBox.SelectionStart = textBox.TextLength;
        //scroll to the caret
        textBox.ScrollToCaret();