0

Hi Everyone,
I would like to know if there is any way to change the color of a part of text in rich textbox when the user types it automatically like the way in vb.net IDE (Classes have blue etc.).
Thanks in advance,
Yuvjeeth

Edited by yuvjeeth

3
Contributors
3
Replies
17
Views
4 Years
Discussion Span
Last Post by ddanbe
0

I guess you're talking about Syntax Highlighting. You need to select that part of text by using SelectionStart & SelectionLength (from RichTextBox) and then, change it's color with SelectionColor.

As an example, this code makes the first 10 characters blue:

richTextBox1.SelectionStart = 0;
richTextBox1.SelectionLength = 10;
richTextBox1.SelectionColor = Color.Blue;
0

but I want to highlight some parts of HTML document such as tags in my app. So how do I do that because all tag lengths are not equal

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.