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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to display the Editcontrol content in MS Print Preview control?

Platform: WinForms |
Control: EditControl |
Published Date: March 3, 2015 |
Last Revised Date: May 24, 2019 |
.NET Framework: 3.5 |
Product Version: 12.3.0.36

In EditControl, the PrintDocument property is used to display the contents of EditControl and it can be assigned to MS PrintPreviewControl by using its property named “Document”. And this Document can be displayed by using the function named ShowDialog. The following code example is to demonstrate the same.

C#

//Object creation.
Form PrintForm = new Form();
//Add print preview controls to Form.
PrintForm.Controls.Add(this.printPreviewControl1);
//Assign EditControl print document to PrintPreview control.
this.printPreviewControl1.Document = this.Editcontrol.PrintDocument;
//To show print dialog.
PrintForm.ShowDialog();
//To show the Edit control print preview dialog.
this.Editcontrol.PrintPreview();

VB

'Object creation.
Private PrintForm As New Form()
'Add print preview controls to Form.
PrintForm.Controls.Add(Me.printPreviewControl1)
'Assign EditControl print document to PrintPreview control.
Me.printPreviewControl1.Document = Me.Editcontrol.PrintDocument
'To show print dialog.
PrintForm.ShowDialog()
'To show the Edit control print preview dialog.
Me.Editcontrol.PrintPreview()

Screenshot:

Showing print preview of editor control content

Sample:  http://www.syncfusion.com/downloads/support/directtrac/general/EditControl_PrintPreview-240270914.zip

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon