static public void ShowError(Exception e)
{
string Message = "UNKNOWN ERROR WHILE PRINTING";
if (e is LinePrinterException)
{
LinePrinterException lpe = (LinePrinterException)e;
if (lpe.ErrorType == LinePrinterException.ErrorTypes.CONFIG_ERROR)
{
Message =
"PRINTER CONFIGURATION ERROR\r\n\r\nPossibly invalid configuration file!";
}
else if (lpe.ErrorType == LinePrinterException.ErrorTypes.PRINTER_ERROR)
{
Message = string.Format(
"PRINTER ERROR\n\r\n\rError # {0} - {1}",
lpe.ErrorCode,GetErrorStr(lpe.ErrorCode));
}
}
MessageBox.Show(Message,
"REPORT ERROR!",
MessageBoxButtons.OK,MessageBoxIcon.Exclamation,
MessageBoxDefaultButton.Button1);
}
Next » Tutorial Part 4
Back « Tutorial Part 2