Skip to main content

Get List of Available Printers


Hi! this is my another tutorial that will get all the lists of available printer installed in your computer.

Now, let's start this tutorial!

1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application.

2. Next, add only one Button named Button1 and labeled it as "Get Printers" and one ListBox named ListBox1 that will serve as the display in the lists of printers. You must design your interface like this:

design

3. Now put this code for your code module.

  1. Imports System.Drawing.Printing
  2. Public Class Form1
  3.  
  4. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  5. Dim index1 As Object
  6. For index1 = 0 To PrinterSettings.InstalledPrinters.Count
  7. ListBox1.Items.Add(PrinterSettings.InstalledPrinters.Item(index1))
  8. Next
  9. End Sub
  10. End Class

Explanation:

We have imported first System.Drawing.Printing, this namespace provides print-related services for Windows Forms applications. When you print from a Windows Forms application, you create a new instance of the PrintDocument class, set properties, such as DefaultPageSettings and PrinterSettings, that describe how to print, and call the Print method to actually print the document. We have initialized a variable index1 that will start to 0 up to all the lists of installed printers. PrintDocument Class defines a reusable object that sends output to a printer, when printing from a Windows Forms application. Then the list of the printers will be added to the listview to display it all.

For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below and hire me.

Best Regards,

Engr. Lyndon R. Bermoy
IT/CoE/CpE Instructor/System Developer/Android Developer
Mobile: 09488225971
Telephone: 826-9296
E-mail:[email protected]

Follow and add me in my Facebook Account: https://www.facebook.com/donzzsky

Visit and like my page on Facebook at: https://www.facebook.com/BermzISware

Visit my website at: www.campcodes.com

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Add new comment

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.