I am programatically adding blocks of text to a RichTextBox control and it
constantly "beeps" when doing so. The program is reading an xml file line by
line and when it finds certain attributes it changes their values to a
different color. This means that a line of xml might have its color changed
several times. I thought it had to do with the changing colors but when i
commented that code out it still beeped. If i write the entire line without
substringing it together i get no beeps. It only seems to happen when i
break the line up and substring it back together.
example:
the True part will beep but the false part will not. Color changing has been
omitted since it's not a factor.
if (true)
{
rtb1.SelectedText = line.Substring(0,10); // originally set color to
black
rtb1.SelectedText = line.Substring(11,10); // changed color to red
rtb1.SelectedText = line.Substring(21,10) + "\r\n"; // changed back to
black
}
else
{
rtb1.SelectedText = line + "\r\n";
}
Anyone know why this happens and is there a way to stop it?
Thanks,
David