We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

All text selection

Hi! Could you tell the right way to make the whole document to be selected as using Ctrl+A shortcut from code-behind?
I tried to do like that:

this.richTextBox.Selection.Select(this.richTextBox.Document.DocumentStart, this.richTextBox.Document.DocumentEnd);

but it is very slow, and i have a problem. The steps are:
- insert hyperlink
- put cursor somewhere after hyperlink
- execute code from above => text selection applied only from that link, not from document begining

Thank you!

3 Replies

VM Venkatesan Mani Syncfusion Team December 5, 2016 09:55 AM UTC

Hi Alexander,

Thank you for using Syncfusion products.

We were able to reproduce the issue “selection using API in SfRichTextBoxAdv control” with the provided steps. A support incident to track the status of this issue has been created under your account. Please log on to our support website to check for further updates


As an alternative solution, you can use the AddSelection() of SelectionRanges property. Please find the sample code from following table. Try this at your end and let us know if this helps you. 
//Clear the existing selections.  this.richTextBox.Selection.SelectionRanges.Clear();  //Adds the document start and end position as new selection range.  this.richTextBox.Selection.SelectionRanges.Add(this.richTextBox.Document.DocumentStart, this.richTextBox.Document.DocumentEnd); 
Best regards,
Venkatesan M 

AL alexander December 5, 2016 12:00 PM UTC

Thank you, this solution works!

VM Venkatesan Mani Syncfusion Team December 6, 2016 04:29 AM UTC

Hi Alexander,

Please let us know if you have any other questions. We will be happy to assist you.

Thank you for using Syncfusion Products.

Venkatesan M. 

To post a reply.
Live Chat Icon For mobile
Up arrow icon