Deleting text selected with Ctrl-A

2 posts, 0 answers
  1. Jim
    Jim avatar
    2 posts
    Member since:
    Mar 2012

    Posted 05 Mar 2013 Link to this post

    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?

     

  2. Petya
    Admin
    Petya avatar
    975 posts

    Posted 06 Mar 2013 Link to this post

    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.

  3. DevCraft banner
Back to Top