The best way to solve the problem would be to used a try-catch exception handling statement, since an unhandled exception will always give unwanted results. Assuming you are programming in C#,
In the
try {…}
you would put the corresponding segment of code and in the
catch {..}
section, you would tell your user that it’s not possible to print the report right now, using a message box or something similar. More details about the try-catch statement can be obtained from this Microsoft page: http://msdn.microsoft.com/en-us/library/0yd65esw(VS.71).aspx
An interesting article about software exceptions handling covering a few languages can also be found here:
http://codebetter.com/blogs/karlseguin/archive/2006/04/05/142355.aspx
Imported from legacy forums. Posted by Ghislain (had 1233 views)