Solved

Vertical Scroll Bars Rich Text Box

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

839 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