programattically adding Text to RichTextBox

  • Thread starter Thread starter Rachel Suddeth
  • Start date Start date
R

Rachel Suddeth

It seems that when I programattically add to the Text property (something
like RichText1.Text += string1), I lose the formatting that was previously
applied to the original Text. Is that how it's supposed to behave? Does that
mean I have to add the text directly to the Rtf property instead? Because
I'm not sure how to add it.... it would need to go before some of the ending
tags, right?

-Rachel
 
Hello,

It is the intended behavior when the whole text in the rich text box is
replaced (RCB.Text = RCB.Text + string1; is actually replacing the whole
text). Try RichTextBox.AppendText() method to append while retaining the
formatting.

-Siva

It seems that when I programattically add to the Text property (something
like RichText1.Text += string1), I lose the formatting that was previously
applied to the original Text. Is that how it's supposed to behave? Does that
mean I have to add the text directly to the Rtf property instead? Because
I'm not sure how to add it.... it would need to go before some of the ending
tags, right?

-Rachel
 
Back
Top