Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using a Rich Text Box to Display Output Stream for a running process in Execution

Posted on 2004-08-19
2
Medium Priority
?
925 Views
Last Modified: 2008-02-01
Dear Expert,
    I have a Rich Text Box winform control used to display output stream information of  a process in execution. When the text being displayed populates the full height(area) of the rich text box,, it doesn't automatically scroll down. The only way to mimick this behavior is if I click my mouse in the Rich Text Box, just after the end of line of the process text string (i.e placing the cursor in a carriage return line feed position). Is there a way to set the Rich Text Box to automatically stay in scroll down position as output text populates the area of the rich text box.

I current set a string variable equal to the output stream. Then I set "this.text = string variable" to display the output stream.

Regards

-K
0
Comment
Question by:Khopkins32
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 3

Accepted Solution

by:
bigjim2000 earned 1000 total points
ID: 11849878
OK, here's how you can do it:

In your method do (assuming rtb is your rich text box):

rtb.Focus();
rtb.Text = variable;
rtb.Select( variable.Length, 0 );
rtb.ScrollToCaret();

This will scroll your box to the bottom.

-Eric
0
 
LVL 3

Expert Comment

by:bigjim2000
ID: 11856761
I suppose another handy thing to do would be to just create this private method:

private void ScrollToBottom(System.Windows.Forms.RichTextBox rtb)
{
  rtb.Focus();
  rtb.Select( rtb.Text.Length, 0 );
  rtb.ScrollToCaret();
}

Then you just call this method, and pass the RichTextBox you want to scroll to the bottom.... Handy :-)

-Eric
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

609 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