How to printpreview contents of RadTextbox?

3 posts, 1 answers
  1. Brendan
    Brendan avatar
    52 posts
    Member since:
    Dec 2011

    Posted 07 May 2013 Link to this post

    In my app a use can load a text file in a radTextbox (logs, etc.)  I want to print/preview the contents but get this error;

        "Unable to cast object of type 'Telerik.WinControls.UI.RadTextBox' to type 'Telerik.WinControls.UI.IPrintable'."

    I presume the RadPrintDocument cannot handle this type of control.  Is there anyway to do this or any other rad control I could use to load the contents of a text file that would work with the RadPrintDocument/print preview feature
  2. Brendan
    Brendan avatar
    52 posts
    Member since:
    Dec 2011

    Posted 07 May 2013 Link to this post

    I achieved what I want through the .net controls, thanks.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Answer
    Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 10 May 2013 Link to this post

    Hello Brendan,

    Thank you for writing.

    The error you get is caused by the fact that all objects assigned to the AssociatedObject property of RadPrintDocument must implement the IPrintable interface. This is the interface through which the object and the print document communicate. If you want to pass a RadTextBox to the RadPrintDocument you will have to create a class that inherits from the text box class and implements the IPrintable interface.

    I hope this will be useful. Should you have further questions, do not hesitate to write back.

    Regards,
    Ivan Petrov
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
Back to Top