views:

996

answers:

1

Hi all. In my form i have a RichTextBox. I also have a VScrollBar and HScrollBar. I set the RichTextBox property ScrollBars to None so i can use the new scroll bars for it. Thats where i hit a problem, how do i do it? I searched online and found nothing for "c# richtextbox vscrollbar"

Please help. Id prefere articles instead of code so i can learn how it works but codes still good :O

A: 

I don't know if there is a way to do what you want. The best thing I can thing of would be to try and find the right position in the text, then Select() and ScrollToCaret(). I usually only use that trick to force a TextBox/RichTextBox to scroll to the very end, though. It wouldn't be very easy to use it for what you want.

Is there a reason why you don't want to use the default scroll bars?

In my experience, I've rarely had any luck anytime I've tried to use custom scroll bars in C# - especially with a control that has the ability to auto-scroll built it.

The only time I've used them without too much trouble is with a third party control that didn't have an auto-scroll capability.

CodeJanitor