RichTextBox Scroll Bar

  • Thread starter Thread starter NoChanceDongle
  • Start date Start date
N

NoChanceDongle

I am building a text parser to scan a text document for predefined tags. I
am using the RTB to display the contents of the plain text file in read only
mode. I parse the file and get a list of tags which I can select from a
list box, then using thier positions and highlight them in the RTB.
However, I cannot work out how to set the viewable area (i.e. set the scoll
bars) to show each selection as I make it.

I have tries ScrollToCaret() but using the richTextBox.Select(int start,
length) does not affect the caret and the position of the scroll does not
change.

Anyone else had a problem with this, or know how to solve it...

Thanks in advance,
Richy :-)
 
Hi again,

Now I solved my problem without using any info from that page..

rtf.Select( rtf.Text.Length, 0 );
rtf.ScrollToCaret();

This scrolls to the end of the text. But only when I activate the form it is
on (?)
Perhaps you should try with a selection length of 0 to affect the caret
position?

HTH,

/Nico
 
Back
Top