Member Avatar for lazlo2000

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
           With rtxtRichTextBox1
Dim tempArray() as String
tempArray = rtxtRichTextBox1.Lines
For each temp in tempArray
  .SelectionStart = lPos - 1
        .SelectionLength = Len(strWord)
        .SelectionColor = Color.Red
    End With
    next
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.