I'm making use of the call to 'PrintToPrinter()' method as part of a simple C# application. Ideally I want to know whether or not the report has printed OK.
I'd scoped my code as follows :
internal static bool DonePrinting()
{
bool okPrinted;
okPrinted = false;
// create report code ..
try
{
// Set report up and log on information for tables
crystalRpt.PrintOptions.PrinterName = "Printer1";
crystalRpt.PrintToPrinter(1, false, 0, 0);
// printed OK
okPrinted = true;
}
catch
{
okPrinted = false;
}
// clear up report work stuff
return okPrinted;
}
I had assumed that had there been a problem with the 'PrintToPrinter()' method the 'catch' element of my method would have come into play and the method would have returned 'false' to the calling code to indicate that there had been a problem with the report (Printer not found for instance).
However this does not appear to be the case - albeit that the printer is not found the method still returns a 'true' value.
Does anyone know how I can establish if the 'PrintToPrinter()' method has actually done the work its supposed to have done ?
Thanks in advance
Steve
I'd scoped my code as follows :
internal static bool DonePrinting()
{
bool okPrinted;
okPrinted = false;
// create report code ..
try
{
// Set report up and log on information for tables
crystalRpt.PrintOptions.PrinterName = "Printer1";
crystalRpt.PrintToPrinter(1, false, 0, 0);
// printed OK
okPrinted = true;
}
catch
{
okPrinted = false;
}
// clear up report work stuff
return okPrinted;
}
I had assumed that had there been a problem with the 'PrintToPrinter()' method the 'catch' element of my method would have come into play and the method would have returned 'false' to the calling code to indicate that there had been a problem with the report (Printer not found for instance).
However this does not appear to be the case - albeit that the printer is not found the method still returns a 'true' value.
Does anyone know how I can establish if the 'PrintToPrinter()' method has actually done the work its supposed to have done ?
Thanks in advance
Steve