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:
3. Now put this code for your code module.
- Imports System.Drawing.Printing
- Public Class Form1
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- Dim index1 As Object
- For index1 = 0 To PrinterSettings.InstalledPrinters.Count
- End Sub
- End Class
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.
Engr. Lyndon R. Bermoy
IT/CoE/CpE Instructor/System Developer/Android Developer
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