Get List of Available Printers
Submitted by donbermoy on Saturday, March 15, 2014 - 22:00.
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
- ListBox1.Items.Add(PrinterSettings.InstalledPrinters.Item(index1))
- Next
- End Sub
- 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 Instructor/System Developer/Android Developer
Mobile: 09079373999
Telephone: 826-9296
E-mail:[email protected]
Visit and like my page on Facebook at: Bermz ISware Solutions
Subscribe at my YouTube Channel at: SerBermz
Add new comment
- 350 views