This documentation is archived and is not being maintained.

PrinterSettings.InstalledPrinters Property

Gets the names of all printers installed on the computer.

Namespace:  System.Drawing.Printing
Assembly:  System.Drawing (in System.Drawing.dll)

Public Shared ReadOnly Property InstalledPrinters As PrinterSettings..::.StringCollection
Dim value As PrinterSettings..::.StringCollection 

value = PrinterSettings.InstalledPrinters

Property Value

Type: System.Drawing.Printing.PrinterSettings.StringCollection
A PrinterSettings.StringCollection that represents the names of all printers installed on the computer.


The available printers could not be enumerated.

You can use the collection of installed printer names to provide the user a choice of printers to print to.

The following code example populates the comboInstalledPrinters combo box with the installed printers and also sets the printer to print, using the PrinterName property, when the selection changes. The PopulateInstalledPrintersCombo routine is called when the form is being initialized. The example requires that a PrintDocument variable named printDoc exists and that the specific combo box exists.

Private Sub PopulateInstalledPrintersCombo()
    ' Add list of installed printers found to the combo box. 
    ' The pkInstalledPrinters string will be used to provide the display string. 
    Dim i as Integer 
    Dim pkInstalledPrinters As String 

    For i = 0 to PrinterSettings.InstalledPrinters.Count - 1
        pkInstalledPrinters = PrinterSettings.InstalledPrinters.Item(i)
End Sub 

Private Sub comboInstalledPrinters_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles comboInstalledPrinters.SelectedIndexChanged
    ' Set the printer to a printer in the combo box when the selection changes. 

    If comboInstalledPrinters.SelectedIndex <> -1 Then 
        ' The combo box's Text property returns the selected item's text, which is the printer name.
        printDoc.PrinterSettings.PrinterName = comboInstalledPrinters.Text
    End If 

End Sub

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0