Controlling RichTextBox scroll position in C#?

C

Charles Randall

I'm trying to write a little chat client, and I need to be able to force
my output textbox to autoscroll down to the bottom of the text. I'm
using a RichTextBox as an output area, and I can't for the life of me
find a way to force it to keep locked to the latest text that's been
added to the control. The only way I've found that might come close
involves using ScrollToCaret(), but this is an annoying workaround,
since I'd have to set the focus to the box, call the function, then
reset the focus to whichever control was in focus during the operation.

Does anyone know a better way to do this? Someone suggested that I use
a listbox instead, but I want to be able to use the benefits that the
RichTextBox offers (links, colored text, etc).

Any help is much appreciated.

Charles.
 

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