P
Patrick Porter
Arrrgh!
I have tried everything (ok, not EVERYTHING) but i cant get solve the
problem of getting syntax highlighting in a rich textbox.
in the code below, im attempting to highlight all of the words "ax".
the matches works fine, but i cant get the highlighting to work correctly.
any help?
thanks,
patrick
Private Sub rtbCode_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles rtbCode.TextChanged
Dim code As String = rtbCode.Text
Dim match As MatchCollection
Dim i As Integer
match = Regex.Matches(code, "ax")
Dim results(match.Count - 1) As String
For i = 0 To results.Length - 1
results(i) = match(i).Index
rtbCode.SelectionStart = match(i).Index
rtbCode.SelectionLength = 3
rtbCode.SelectionColor = Color.Blue
Next
End Sub
I have tried everything (ok, not EVERYTHING) but i cant get solve the
problem of getting syntax highlighting in a rich textbox.
in the code below, im attempting to highlight all of the words "ax".
the matches works fine, but i cant get the highlighting to work correctly.
any help?
thanks,
patrick
Private Sub rtbCode_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles rtbCode.TextChanged
Dim code As String = rtbCode.Text
Dim match As MatchCollection
Dim i As Integer
match = Regex.Matches(code, "ax")
Dim results(match.Count - 1) As String
For i = 0 To results.Length - 1
results(i) = match(i).Index
rtbCode.SelectionStart = match(i).Index
rtbCode.SelectionLength = 3
rtbCode.SelectionColor = Color.Blue
Next
End Sub
