change the color of a line or a word in a richtextbox?

ElektroStudios picture ElektroStudios · Nov 27, 2012 · Viewed 21.5k times · Source

I can change the color of ONE line and/or ONE word perserving the other colors in the richtextbox?

For example i want to change the line "Processing: ..." to yellow colour, It's possible?

Thankyou for read

enter image description here

Answer

Nepaluz picture Nepaluz · Nov 14, 2014

This is probably coming a tad late, but all you need to do is set the selectioncolor to the color you want before appending the text to the richtextbox, then reverting back to the original color after that, e.g

With RichTextBox1
  .SelectionColor = Color.Yellow
  .AppendText("Processing: ")
  .SelectionColor = Color.LimeGreen
  .AppendText("el senor de los anillakos.avi" & vbCr)
End With