Getting list of printers

Yaron

Member
Joined
Dec 8, 2003
Messages
6
Hi

How can I find using C# the list of printers available?
In VB, I used to do the following:

Dim oPrn As Printer

For Each oPrn In Printers
AddToList oPrn.DeviceName
Next


Thanks
 
straight from msdn

C#:
private void PopulateInstalledPrintersCombo()
{
    // Add list of installed printers found to the combo box.
    // The pkInstalledPrinters string will be used to provide the display string.
    String pkInstalledPrinters;
    for (int i = 0; i < PrinterSettings.InstalledPrinters.Count; i++){
        pkInstalledPrinters = PrinterSettings.InstalledPrinters[i];
        comboInstalledPrinters.Items.Add(pkInstalledPrinters);
    }
}
 
Back
Top