How to highlight text in richtextbox? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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.

19th Apr 2018, 1:05 PM
Byte
Byte - avatar
1 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;
21st Apr 2018, 10:34 AM
kukogho gabriel
kukogho gabriel - avatar