Monday, July 27, 2009

How to find system's default printer name using c#.Net 2.0 code?

Can anyone tell me how to find system's default printer name using c#.Net 2.0 code?

How to find system's default printer name using c#.Net 2.0 code?
Try this code................











public static string DefaultPrinterName()


{


string functionReturnValue = null;


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





try {


functionReturnValue = oPS.PrinterName;


}


catch (System.Exception ex) {


functionReturnValue = "";


}


finally {


oPS = null;


}


return functionReturnValue;


}


No comments:

Post a Comment