I've been trying and googling for ages, I've found two solutions to my problem, however both of them don't seem to do a very good job.
1.
I have a timer that makes a backup of the RichTextBox in general, so I slotted the following code in the timer and it fires off every 10 seconds,
Code:
Dim i as Integer = 0
Do Until i = 25
RichTextBoxFR1.Find("'")
RichTextBoxFR1.SelectionColor = Color.Green
RichTextBoxFR1.Find("Sub")
RichTextBoxFR1.SelectionColor = Color.Blue
i = i + 1
Loop
Now I would possibly use this option however it causes bad flickering and highlights everything extremley fast and moves the TextBox around, so it's not very silent ;_;.
2.
Realtime Syntax Highlight
So your probably thinking, well why not use it? It's not quite complex, but it's the fact I'm not sure how intergrate the class into my Current RTB modfication:
XD Code:
Public Class RichTextBoxFR
Inherits RichTextBox
Public Sub FindAndReplace(ByVal FindText As String, ByVal ReplaceText As String)
Me.Find(FindText)
If Not Me.SelectionLength = 0 Then
Me.SelectedText = ReplaceText
Else
MsgBox("The following specified text was not found: " & FindText)
End If
End Sub
Public Sub FindAndReplace(ByVal FindText As String, ByVal ReplaceText As String, ByVal ReplaceAll As Boolean, _
ByVal MatchCase As Boolean, ByVal WholeWord As Boolean)
Select Case ReplaceAll
Case False
If MatchCase = True Then
If WholeWord = True Then
Me.Find(FindText, RichTextBoxFinds.MatchCase Or RichTextBoxFinds.WholeWord)
Else
Me.Find(FindText, RichTextBoxFinds.MatchCase)
End If
Else
If WholeWord = True Then
Me.Find(FindText, RichTextBoxFinds.WholeWord)
Else
Me.Find(FindText)
End If
End If
If Not Me.SelectionLength = 0 Then
Me.SelectedText = ReplaceText
Else
MsgBox("The following specified text was not found: " & FindText)
End If
Case True
Dim i As Integer
For i = 0 To Me.TextLength
If MatchCase = True Then
If WholeWord = True Then
Me.Find(FindText, RichTextBoxFinds.MatchCase Or RichTextBoxFinds.WholeWord)
Else
Me.Find(FindText, RichTextBoxFinds.MatchCase)
End If
Else
If WholeWord = True Then
Me.Find(FindText, RichTextBoxFinds.WholeWord)
Else
Me.Find(FindText)
End If
End If
If Not Me.SelectionLength = 0 Then
Me.SelectedText = ReplaceText
Else
MsgBox(i & " occurrence(s) replaced")
Exit For
End If
Next i
End Select
End Sub
End Class
So in the end, the question is do I just add the subs on or?