views:

47

answers:

3

Hi all,

I want to write code in C# for loading printer name in window. But I don't have any ideas to write it.

Can anybody help me to solve this problem?

Thanks. Ung Sopolin

A: 

Include a reference to the System.Drawing library and then:

var printers = PrinterSettings.InstalledPrinters.Cast<string>();

foreach (var printer in printers)
{
    Console.WriteLine(printer);
}

I think you might be interested in this post.

Lucas McCoy
A: 

Use PrinterSettings class from the System.Drawing.Printing namespace

PrinterSettings.InstalledPrinters

should return you a list of Printers.

AB Kolan
A: 

PrinterSettings prSetting = new PrinterSettings();

Then prSetting.PrinterName will get you the name of the default printer name. You can use the same class for other Printer information.

Sesh