This is a migrated thread and some comments may be shown as answers.

Change Text from within Selection

1 Answer 36 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Marcel
Top achievements
Rank 1
Marcel asked on 21 Nov 2011, 10:02 AM
Hi, 

I was wondering how i would change the text from a Selection. 

For Example: 

I obtain a selection of the document using bookmarks: 
RadRichTextDocument.Document.Selection.SelectAnnotationRange(bookmark);

Then I would like to change the text in the current Selection. How would i do this? 

//Obviously this doesnt work. But something like this. 
RadRichTextDocument.Document.Selection = "New changed text";
Thanks

1 Answer, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 23 Nov 2011, 07:02 PM
Hi Chez,

You can delete the text in the selection and insert the new text like this:
RadRichTextDocument.Delete(false);
RadRichTextDocument.Insert("New changed text");

More information on programmatic find/replace can be found in this article.

Kind regards,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
RichTextBox
Asked by
Marcel
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Share this question
or