---
title: "PrintDocument PrintPreviewDialog and PrintDialog Control in VB.Net"  
description: "The PrintDialog control is used to open the Windows Print Dialog. A PrintDocument component allows users to send an output to a printer. By the help"  
author: "Pushpendra Singh"  
published: 2010-12-13  
updated: 2020-05-24  
canonical: https://www.mindstick.com/articles/300/printdocument-printpreviewdialog-and-printdialog-control-in-vb-dot-net  
category: "vb.net"  
tags: ["vb.net"]  
reading_time: 2 minutes  

---

# PrintDocument PrintPreviewDialog and PrintDialog Control in VB.Net

The PrintDialog control is used to open the Windows Print Dialog. A PrintDocument component allows users to send an output to a printer. By the help of PrintPreviewDialog, You can preview a document.\

**How to PrintDocument and check PrintPreview in VB.Net.**

Drag and drop PrintDocument control, PrintDialog control and PrintPreviewDialog control from the toolbox on the WindowForm.

![PrintDocument PrintPreviewDialog and PrintDialog Control in VB.Net](https://www.mindstick.com/mindstickarticle/f8fd0f1d-d6a1-4581-bf24-f72deaeda85b/images/8ed221c8-d816-4f97-8111-f653e11c642b.png)

![PrintDocument PrintPreviewDialog and PrintDialog Control in VB.Net](https://www.mindstick.com/mindstickarticle/f8fd0f1d-d6a1-4581-bf24-f72deaeda85b/images/2d6c164b-b82e-4363-9159-5b54ecc84c29.png)

**PrintDocument:** The PrintDocument object encapsulates all the information needed to print a page. They associate with the control which content can be print. They handle the events and operations of printing.

**Step1**: Associate control to print the document

```
    Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e  As System.Drawing.Printing.PrintPageEventArgs)  Handles PrintDocument1.PrintPage     e.Graphics.DrawString(Label1.Text, Label1.Font, Brushes.Black, 100, 100)           e.Graphics.PageUnit = GraphicsUnit.Inch  End Sub
```

**Step2:** Write code for printing and print preview.

```
'open the print dialog on Print Button click  Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click         PrintDialog1.Document = PrintDocument1 'PrintDialog associate with PrintDocument.         If PrintDialog1.ShowDialog() = DialogResult.OK Then            PrintDocument1.Print()         End If  'open the print preview on PrintPreview Button click   Private Sub btnPrintPreview_Click(ByVal sender As System.Object, ByVal e  As System.EventArgs) Handles btnPrintPreview.Click PrintPreviewDialog1.Document = PrintDocument1 'PrintPreviewDialog associate with PrintDocument.         PrintPreviewDialog1.ShowDialog() 'open the print preview  End Sub
```

**Run the project**

![PrintDocument PrintPreviewDialog and PrintDialog Control in VB.Net](https://www.mindstick.com/mindstickarticle/f8fd0f1d-d6a1-4581-bf24-f72deaeda85b/images/c84166c6-1c4b-4e24-b7d4-cf8366f8fc4c.png)

When you click the Print Preview button then the preview will show.

![PrintDocument PrintPreviewDialog and PrintDialog Control in VB.Net](https://www.mindstick.com/mindstickarticle/f8fd0f1d-d6a1-4581-bf24-f72deaeda85b/images/fe4cf990-bc52-48ee-8429-23d6baf73534.png)

When clicking the print button then the print dialog will open.

![PrintDocument PrintPreviewDialog and PrintDialog Control in VB.Net](https://www.mindstick.com/mindstickarticle/f8fd0f1d-d6a1-4581-bf24-f72deaeda85b/images/85da172a-6e83-4568-b6d7-8ad9369e5026.png)

When you click print then the output will go to the printer.

[You should Read also this Article - **[ToolBarTray Control in WPF](https://www.mindstick.com/Articles/547/toolbartray-control-in-wpf)** ]

---

Original Source: https://www.mindstick.com/articles/300/printdocument-printpreviewdialog-and-printdialog-control-in-vb-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
