1
Reply

Richtextbox: Coloring words knowing their index ?

Ask a question
ParadoX

ParadoX

16 years ago
1.9k
1
Hi !

I've been trying to color words in a RichTextBox in red. I made this and it works:


foreach (string sentence in splittedOriginalText)
{
richTextBox1.SelectionColor = Color.Black;
for (int i = 0; i < keywords.Length; i++)
{
if (keywords == sentence.ToLower())
{
richTextBox1.SelectionColor = Color.Red;
break;
}
}
richTextBox1.SelectedText = sentence + " ";
}


Now things have changed. I don't have any keywords to compare my words to, but only the index of the words that need to be colored. I've been trying, but somehow it won't work ... any idea to help me out here ?

Answers (1)