List of Printers currently installed

This gets the list of printers that are currently installed

Dim sPrinterName As String 
For Each sPrinterName In System.Drawing.Printing.PrinterSettings.InstalledPrinters
Next sPrinterName

Using the Windows Management Instrumentation (WMI) Library

This can be used to provide a list of all network printers.
It is an additional library though and therefore will require an additional reference (System.Management.dll)

Dim objSearcher As Management.ManagementObjectSearcher 
Dim objCollectionResults As Management.ManagementObjectCollection
Dim objPrinter As Management.ManagementObject

objSearcher = New Management.ManagementObjectSearcher("Select * FROM Win32_Printer")
objCollectionResults = objSearcher.Get()
For Each objPrinter In objCollectionResults
Next objPrinter

Information about the Default Printer

Printer settings can be accessed from within the PrintDocument object

Dim objPrintDocument As System.Drawing.Printing.PrintDocument 


Getting Display Dimensions

This will tell you the size of the users screen.

Dim objStringBuilder As System.Text.StringBuilder 
Dim objScreen As Screen

'number of screens

For Each objScreen In Screen.AllScreens
Next objScreen

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext