PrintPreviewDialog in Visual Basic .NET

Tags: VB.NET, VB 2008, VB 2010, VB 2012, VB 2013

This lesson describes the PrintPreviewDialog control


This component displays a dialog box that shows how the print document will look like when it is printed.

Its most important property is Document, which determines the PrintDocument object that the dialog box previews.

The component's most important methods are Show, which displays the dialog box Modelessly, and ShowDialog, which displays the dialog box modally.

This component is remarkably simple to use. Set its Document property and catch the PrintDocument object's PrintPage event as shown in the previous lesson.

Then display the dialog box as in the following code:


The rest is automatic. The dialog box lets the user move through the document's pages, zoom in and out, and even print the document.


The tools that run across the top of the dialog box, automatically give the user the following features:

- The Print button prints the document

- The Zoom menu lets the user zoom to scales between 10% and 500%, or to select Auto zoom

- The Green buttons make the dialog box display one, two, three, four, or six pages at a time

- The Close button closes the dialog box

- The Page NumericUpDown control lets the user select the number of the page to display

Previous Lesson | Next Lesson

Share This