string[] words = textBox1.Text.Split(',');
foreach (string word in words)
{
int startindex = 0;
while (startindex < richTB1.TextLength)
{
int wordstartIndex = richTB1.Find(word, startindex, RichTextBoxFinds.None);
if (wordstartIndex != -1)
{
richTB1.SelectionStart = wordstartIndex;
richTB1.SelectionLength = word.Length;
richTB1.SelectionBackColor = Color.GreenYellow;
}
else
break;
startindex += wordstartIndex + word.Length;
}
}