Return to Snippet

Revision: 2432
at February 14, 2007 17:42 by rengber


Initial Code
public bool IsValid
{
  get 
  {
    bool retVal = false; 
    try
    {
      PrintDocument pd = new PrintDocument();
      pd.PrinterSettings.PrinterName = printerName;
      retVal = pd.PrinterSettings.IsValid;
    }
    catch(System.Exception ex)
    {
      string errorMsg = ""; 
      errorMsg = "Printer Error:" + printerName + ex.ToString();
      Trace.WriteLine(errorMsg);
      retVal = false;
    }
    return retVal; 
  }
}

Initial URL

                                

Initial Description
Amazingly fast.  Doesn't throw exceptions if the printer doesn't exist.

Initial Title
Check the Status of a Printer

Initial Tags

                                

Initial Language
C#