Hello,
I have a RichTextBox that has a large number of lines, well in excess of the amount that can be seen without scrolling. Upon an event, such as clicking a button, I would like to move the viewable portion of the RichTextBox to be able to see that particular line. In other words, if the RichTextBox has 1000 lines of text, how can I force the viewable portion to start at, say, line number 123?
This is what I have tried so far:
RichTextBox1.SelectionStart = RichTextBox1.GetFirstCharIndexFromLine(123)
RichTextBox1.SelectionLength = 0
RichTextBox1.ScrollToCaret()
I pretty much know I am not setting the SelectionStart property to the right value, but I don't really understand what the SelectionStart property is referencing: line number, position in the file, etc. The help page says it gets or sets the starting point of text selected in the text box. What does it mean for text to be "selected"?
Thanks,
Andrew