How to change default printer using c#.net?

  • Thread starter Thread starter Andrew
  • Start date Start date
A

Andrew

Hello, friends,

We need to programmatically change default printer in our c#.net 2005
application. We tried:

System.Drawing.Printing.PrinterSettings oPS = new
System.Drawing.Printing.PrinterSettings();

try
{
oPS.PrinterName = defaultPrinterName;
}
catch (System.Drawing.Printing.InvalidPrinterException ix)
{
Console.WriteLine(ix.Message);
return false;
}
finally
{
oPS = null;
}

but, no luck. The thrid party applications, say MS Word/NotePad, still use
previous default printer, not the new specified one.

Any ideas? Thanks a lot.
 
Back
Top