4 Answers, 1 is accepted
0
Accepted
Hello Karl,
Thank you for writing.
RadRichTextBox holds its content in RadDocument. Setting the Document property of RadRichTextBox to a new instance of RadDocument will clear the previous document will its data:
I hope that the provided information addresses your question. Should you have any other questions, do not hesitate to contact us.
Kind regards,
Stefan
the Telerik team
Thank you for writing.
RadRichTextBox holds its content in RadDocument. Setting the Document property of RadRichTextBox to a new instance of RadDocument will clear the previous document will its data:
radRichTextBox1.Document =
new
RadDocument();
I hope that the provided information addresses your question. Should you have any other questions, do not hesitate to contact us.
Kind regards,
Stefan
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
0
Hannah
Top achievements
Rank 2
answered on 18 Oct 2013, 08:42 PM
I started with that, but then began to wonder if I was introducing any additional memory overhead by creating a new document instead of simply using a "Clear" method of some type.
In my situation, I'm creating an on-the-fly preview of text, and the document will be re-created several times as the user goes from place to place in another part of the screen. Will I incur unnecessary memory overhead from creating a new document repeatably?
Would it be advisable to create several documents that I'll swap in and out of view as I need them?
Thanks!
Wayne
In my situation, I'm creating an on-the-fly preview of text, and the document will be re-created several times as the user goes from place to place in another part of the screen. Will I incur unnecessary memory overhead from creating a new document repeatably?
Would it be advisable to create several documents that I'll swap in and out of view as I need them?
Thanks!
Wayne
0
Hello Wayne,
In general, the old instance of the Document will not be referenced anywhere and it will be collected by the Garbage Collector when needed, so this should not incur any memory overhead.
Alternative method to clear a document will be to simply select its content and delete it:
You can use this one if you prefer.
I hope this helps.
Regards,
Stefan
Telerik
In general, the old instance of the Document will not be referenced anywhere and it will be collected by the Garbage Collector when needed, so this should not incur any memory overhead.
Alternative method to clear a document will be to simply select its content and delete it:
this
.radRichTextBox1.Document.Selection.SelectAll();
this
.radRichTextBox1.Document.Delete(
false
);
You can use this one if you prefer.
I hope this helps.
Regards,
Stefan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Hannah
Top achievements
Rank 2
answered on 22 Oct 2013, 06:23 PM
Wonderful! Thanks!