Software Development Network>> Visual C#>> how do i change the font color of a String.SubString in a textBox?
for example txtBox.text = "The color is green";
i want to display the word green as "green". is there a way to do that
thanks i want to use rtf format but i don't know how to extract the plain text from the rtf code and display it in a reportviewer.
anyway i have decided to use delimeters, "/*" and "*/", how can i find their indices if they're all over the rtb
i got the change color part, here's what i have:
this
now my problem is how can i highlight or select multiple substrings from txt.Text
how do i change the font color of a String.SubString in a textBox?
Vurg
Use the Select method to select a piece of text and set the color. Then re-select something else and set the color.
if( myRichTextBox.TextLenght >= 5 )
{
myRichTextBox.Select( 0, 5 );
myRichTextBox.SelectionColor = Color.Green;
}
if( myRichTextBox.TextLenght >= 15 )
{
myRichTextBox.Select( 10, 15 );
myRichTextBox.SelectionColor = Color.Red;
}
RayCh
Dan Kahler
thanks i want to use rtf format but i don't know how to extract the plain text from the rtf code and display it in a reportviewer.
anyway i have decided to use delimeters, "/*" and "*/", how can i find their indices if they're all over the rtb
mina_mina
Nitron
i got the change color part, here's what i have:
this
.txt.Select(start, len); this.txt.SelectionColor = Color.Green;now my problem is how can i highlight or select multiple substrings from txt.Text