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

How to printpreview contents of RadTextbox?

2 Answers 105 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
Brendan
Top achievements
Rank 1
Brendan asked on 07 May 2013, 12:34 PM
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 Answers, 1 is accepted

Sort by
0
Brendan
Top achievements
Rank 1
answered on 07 May 2013, 06:35 PM
I achieved what I want through the .net controls, thanks.
0
Accepted
Ivan Petrov
Telerik team
answered on 10 May 2013, 09:35 AM
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.
Tags
TextBox
Asked by
Brendan
Top achievements
Rank 1
Answers by
Brendan
Top achievements
Rank 1
Ivan Petrov
Telerik team
Share this question
or