How to highlight text in richtextbox? | SoloLearn: Learn to code for FREE!

0

How to highlight text in richtextbox?

i need help,i need to highlight custom words in richtextbox (Visual Studio WinForms) like if in richtextbox printed "hello",hello word will be blue color,it says,if printed "hello all",only hello word be a blue color.

4/19/2018 1:05:49 PM

Byte

1 Answer

New Answer

+1

int blockStart = 1; // where to start int blockLength = 5; // hello is 5 letters richTextBox1.SelectionStart = blockStart; richTextBox1.SelectionLength = blockLength; richTextBox1.SelectionBackColor = Color.Blue;