You probably got annoyed when you read the title, it must have been asked a million times. But unfortunatly I cant get it working for myself. Ive been using this code to highlight the word "var":
Dim search As String = "var" Dim index As Integer = RichTextBox1.Text.IndexOf(search) If (index <> -1) Then RichTextBox1.Select(index, search.Length) RichTextBox1.SelectionFont = New Font(fontfamily, fontsize, FontStyle.Bold) End If
But it selects the word "var" and then afterwards, it makes the whole RichTextBox have this font.
Does someone know how to change this so that it only changes the font of the word "var"?