Solved

Vertical Scroll Bars Rich Text Box

Posted on 2004-03-24
4
368 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
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!
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now