RichTextBox, ScrollToCarret, No Focus?

J

Jean-Francois Lord

Hello,

I have a multithreaded windows app that has a RichTextBox acting as an
output console for the worker threads. I need a way of scrolling down to the
bottom of the RichTextBox as text is added without stealing the focus from
my other controls.

RichTextBox.Focus()
RichTextBox.ScrollToCarret()

This does not work for me since I have an axWebBrowser control and I cannot
restore the focus to it's child controls, i.e. it's text boxes.

Does anyone have a way of scrolling the RichTextBox without stealing the
focus?

Thanks,
Jean Lord
 
H

Herfried K. Wagner [MVP]

* "Jean-Francois Lord said:
I have a multithreaded windows app that has a RichTextBox acting as an
output console for the worker threads. I need a way of scrolling down to the
bottom of the RichTextBox as text is added without stealing the focus from
my other controls.

RichTextBox.Focus()
RichTextBox.ScrollToCarret()

This does not work for me since I have an axWebBrowser control and I cannot
restore the focus to it's child controls, i.e. it's text boxes.

Does anyone have a way of scrolling the RichTextBox without stealing the
focus?

I don't have a solution to your problem, but notice that Windows Forms
controls are not safe for multithreading. You will have to use the
control's 'Invoke' method to call members of the control from an other
thread.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top