[VB.NET]Change certain text color?

Newbie Spellweaver
Joined
Jun 22, 2008
Messages
12
Reaction score
0
Anyway I'm looking for a way to change text color, for instance if it contains "value" then I need the text to turn blue. So far I have this: but is there any other way?
Code:
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If (RichTextBox1.Text.Contains("value]")) Then
            RichTextBox1.SelectionStart = RichTextBox1.Find("value")

            Dim theColor As System.Drawing.Color
            theColor = Color.Blue
            RichTextBox1.SelectionColor = theColor
        End If
    End Sub
 
I'm going to make it sort of like a coding system hopefully, where "version" is always red, and "Name" is always blue etc.
 
I actually meant value sorry, but I've been trying for ever and I've failed so much, someone please help
 
this should do it for an richtextbox.
Code:
                    RichTextBox1.ForeColor = Color.Red()
                    RichTextBox1.Text = "Error while downloading"
                    RichTextBox1.AppendText(Environment.NewLine)

and this code all newlines will be red.
you can use the code multiply times to change the color line be line.
 
Back