Reader Level:
Articles

How to Get Printers Listing in C#

By Mahesh Chand on Jun 08, 2007
The code snippet in this how do I shows you how to get all available printers in C#.
  • 0
  • 0
  • 65140

Import System.Drawing.Printing namespace in your application.

Add a DropDownList and change its name to printersList and write this below code on Form's load event handler.

private void Form1_Load (object sender, System.EventArgs e)

{

foreach (String printer in PrinterSettings.InstalledPrinters)

{

printersList.Items.Add (printer.ToString());

}

}

The DropDownList will show all printers available on your network.

Mahesh Chand

C# Corner founder, 10-times Microsoft MVP, technical author, and software architect. Mahesh authored his first book, A Programmer’s Guide to ADO.NET in C# with APress at the age of 25. C# Corner is a memb... Read more

COMMENT USING