clatten
September 20th, 2004, 09:26 AM
I want to do a simple search function in a richtextbox. I have loaded a file and by using the Find method it's possible to find a text string, highlight the string and extract the line number, but how can I programatically scroll down to the line?
private int findText(string searchText, int searchStart, int searchEnd)
{
int indexToText = richTextBox1.Find(searchText, searchStart, searchEnd, RichTextBoxFinds.MatchCase);
richTextBox1.SelectionColor = Color.Blue;
int lineNo= richTextBox1.GetLineFromCharIndex(indexToText);
return indexToText;
}
private int findText(string searchText, int searchStart, int searchEnd)
{
int indexToText = richTextBox1.Find(searchText, searchStart, searchEnd, RichTextBoxFinds.MatchCase);
richTextBox1.SelectionColor = Color.Blue;
int lineNo= richTextBox1.GetLineFromCharIndex(indexToText);
return indexToText;
}