I'm new to VB.net and I'm stumped as to how to do this.
I want to find specific text in a richtextbox and color it red, but the problem is that I only want it to search (on each line) at the 15th character to the end of the line.
Here is my code:
lspos = 1
strWord = cboSixth.Text
lPos = InStr(lspos, rtxtRichTextBox1.Text, strWord, vbTextCompare)
While lPos > 0
With rtxtRichTextBox1
.SelectionStart = lPos - 1
.SelectionLength = Len(strWord)
.SelectionColor = Color.Red
End With
lspos = lPos + 1
lPos = InStr(lspos, rtxtRichTextBox1.Text, strWord, vbTextCompare)
End While
rtxtRichTextBox1.SelectionStart = Len(rtxtRichTextBox1.Text)
rtxtRichTextBox1.SelectionLength = 0
rtxtRichTextBox1.SelectionColor = Color.Black