[VB.NET]Change certain text color?
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
Re: [VB.NET]Change certain text color?
Will you be using this for multiple colours, such as a custom style colour selector?
Re: [VB.NET]Change certain text color?
I'm going to make it sort of like a coding system hopefully, where "version" is always red, and "Name" is always blue etc.
Re: [VB.NET]Change certain text color?
Code:
(RichTextBox1.Text.Contains("value]")) Then
im taking that "value]" is just a mistake when adding the post right?
Re: [VB.NET]Change certain text color?
I actually meant value sorry, but I've been trying for ever and I've failed so much, someone please help
Re: [VB.NET]Change certain text color?
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.