Hello, I'm making a little app that runs through a Richtextbox and makes it turn string "[BK]" red.
But I can't get it to make all of the "[BK]"'s red.
i found this little piece of code, but I can't get it to work, it looks like it should though.
Dim textEnd As Integer = TextBox1.TextLength Dim index As Integer = 0 Dim lastIndex As Integer = TextBox1.Text.LastIndexOf(TextBox1.Text) While index < lastIndex TextBox1.SelectionStart = TextBox1.Find(TextBox1.Text, index, textEnd, RichTextBoxFinds.None) TextBox1.SelectionColor = Color.Red index = TextBox1.Text.IndexOf("[BK]", index) + 1 End While
Any help is appreciated:)