Get List of Available Printers

Submitted by: 
Visitors have accessed this post 374 times.

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


Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • You may insert videos with [video:URL]
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <th> <img> <h1> <h2> <h3> <iframe> [video]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.