How to make a Print Preview in Visual Basic PDF Print E-mail
Written by Joris Bijvoets   
Tuesday, 05 January 2010 14:25

Print Preview in VB.Net using PrintPreviewDialog

In Vb.net you can easily make a Print Preview by using the PrintPreviewDialog and the PrintDocument objects.

How to use the PrintDocument object is described in another article concerning printing in Visual Basic.

The PrintPreview object can be used in this way:

'Assuming you already have defined a PrintDocument object named PrintDocument1, with the right events to draw on this document

Dim PrintPreviewDialog1 as New System.Windows.Forms.PrintPreviewDialog()
PrintPreviewDialog1.Document = PrintDocument1
PrintPreviewDialog1.Show()

The first line defines a new PrintPreviewDialog object.

The second line sets the Document property of this PrintPreviewDialog to the PrintDocument object you have defined.

The third line shows the PrintPreview.

 

 

Last Updated on Wednesday, 06 January 2010 06:17