Code:
Private Sub MakeColored()
    For x = 1 To Len(rtfbox.Text)
        If Mid(rtfbox.Text, x, Len("SELECT")) = "SELECT" Then
            rtfbox.SelStart = x - 1
            rtfbox.SelLength = Len("SELECT")
            rtfbox.SelColor = vbBlue
            rtfbox.SelLength = 0
            rtfbox.SelColor = vbBlack
            x = (x - 1) + Len("SELECT")
        Else
            rtfbox.SelColor = vbBlack
        End If
    Next x

    rtfbox.SelStart = Len(rtfbox.Text)
End Sub
I havve this code to look for the word "SELECT" in a RichTextBox, and if found, color it blue. This works the first time, but if I run the code again, it colors evrything blue! Who can tell me why?