RichBox 屬性Name : TextError
Private Function Colored_keywords(ByVal keywords As String) As Boolean
Dim startText As Integer = 0
Dim endText As Integer
endText = TextError.Text.LastIndexOf(keywords)
TextError.SelectAll()
While startText < endText
TextError.Find(keywords, startText, TextError.TextLength, RichTextBoxFinds.MatchCase)
TextError.SelectionColor = Color.Brown
startText = TextError.Text.IndexOf(keywords, startText) + 1
End While
Me.Refresh()
Return True
End Function