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

Deleting text selected with Ctrl-A

1 Answer 74 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Jim
Top achievements
Rank 1
Jim asked on 05 Mar 2013, 04:33 PM

If I use Ctrl-A to select all the data in the RichTextBox, and then use Document.Delete to delete it, I get an InvalidCastException. The exception is "Unable to cast object of type 'Telerik.Windows.Documents.Layout.TableLayoutBox' to type 'Telerik.Windows.Documents.Layout.ParagraphLayoutBox'.  If I select just a portion of the text in the RichTextBox and then use Document.Delete() to remove it, I have no problem.  Is there some other method that should be used to delete text that has been selected with Ctrl-A?

 

1 Answer, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 06 Mar 2013, 04:26 PM
Hello Jim,

The issue you are facing is a know one and has been discussed in this forum thread. Basically, you can solve it in one of the following ways:
  • Use the RadRichTextBox.Delete() method instead.
  • Create a RadDocumentEditor that will mimic a RadRichTextBox containing your document and call its Delete() method.

Let us know if you have other questions.
 
Greetings,
Petya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
RichTextBox
Asked by
Jim
Top achievements
Rank 1
Answers by
Petya
Telerik team
Share this question
or