control is used to open the Windows Print Dialog and let user select the
printer, set printer and paper properties and print a file. A typical Open File
Dialog looks like Figure 1 where you select a printer from available printers,
set printer properties, set print range, number of pages and copies and so on.
Clicking on OK button sends the document to the printer.
Creating a PrintDialog
We can create a PrintDialog at design-time as well as at
To create a PrintDialog control at design-time, you simply
drag and drop a PrintDialog control from Toolbox to a Form in Visual Studio.
After you drag and drop a PrintDialog on a Form, the PrintDialog looks like
a PrintDialog control at run-time is simple. First step is to create an instance
of PrintDialog class and then call the ShowDialog method. The following code
snippet creates a PrintDialog control.
PrintDialog1 As New
object represents a document to be printed. Once a PrintDocument is created, we
can set the Document property of PrintDialog as this document. After that we can
also set other properties. The following code snippet creates a PrintDialog and
sends some text to a printer.
sender As System.Object,
ByVal e As
printDlg As New
printDoc As New
printDlg.Document = printDoc
= DialogResult.OK) Then
control allows users to launch Windows Open File Dialog and select a file to be
printed. In this article, we discussed how to use a Windows Open File Dialog and
set its properties in a Windows Forms application.