I found this code and customized it specifically for my application. All it does is change all The letter F to red in a richtextbox. It works in most cases but in certain instances, it gets thrown in an endless loop.
***************
Public Function highlight_F()
RichTextBox1.SelectAll()
RichTextBox1.SelectionColor = Color.Black
RichTextBox1.SelectionBackColor = Color.White
RichTextBox1.DeselectAll()
Dim FoundAtPosition As Integer
FoundAtPosition = RichTextBox1.Find("F")
RichTextBox1.SelectionColor = Color.Red
RichTextBox1.SelectionFont = New Font("Arial", 12, FontStyle.Bold)
Do Until FoundAtPosition < 0
RichTextBox1.SelectionColor = Color.Red
RichTextBox1.SelectionFont = New Font("Arial", 12, FontStyle.Bold)
FoundAtPosition = RichTextBox1.Find("F", FoundAtPosition + 1, RichTextBoxFinds.None)
Loop
End Function
***************
Public Function highlight_F()
RichTextBox1.SelectAll()
RichTextBox1.SelectionColor = Color.Black
RichTextBox1.SelectionBackColor = Color.White
RichTextBox1.DeselectAll()
Dim FoundAtPosition As Integer
FoundAtPosition = RichTextBox1.Find("F")
RichTextBox1.SelectionColor = Color.Red
RichTextBox1.SelectionFont = New Font("Arial", 12, FontStyle.Bold)
Do Until FoundAtPosition < 0
RichTextBox1.SelectionColor = Color.Red
RichTextBox1.SelectionFont = New Font("Arial", 12, FontStyle.Bold)
FoundAtPosition = RichTextBox1.Find("F", FoundAtPosition + 1, RichTextBoxFinds.None)
Loop
End Function