Solved

Vertical Scroll Bars Rich Text Box

Posted on 2004-03-24
4
393 Views
Last Modified: 2008-01-16
How do I get a vertical scroll bar to scroll down with the text entered into Rich Text Box Control?  I have given the rich text box the following properties:

this.displayTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.displayTextBox.Multiline = true;

But the scroll bar stays at the top of the rich text box when the text is greater than the length of the text box!!  Can anyone provide any code so that the scroll bar stays at the bottom of the rich text box?
0
Comment
Question by:garth15
4 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 250 total points
ID: 10667341
I made small test and found that when user types text to multi-line RichTextBox, it is scrolled down automatically.
However, when text is set from the program, this doesn't happen. To do this you can use ScrollToCaret function:

richTextBox1.Text = "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n2";       // test
richTextBox1.Select(richTextBox1.Text.Length, 0);
richTextBox1.ScrollToCaret();
0
 
LVL 15

Assisted Solution

by:SRigney
SRigney earned 250 total points
ID: 10669193
RichTextBox1.SelectionStart = RichTextBox1.Text.Length;
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Example works but why do I need to click twice on button 4 55
FTP file download using c# 3 28
Sort GridView by ID Descending 1 24
c#, case, if 4 16
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question