Winforms Custom Exception (VB or C#)

conrad2010
conrad2010 used Ask the Experts™
on
I am using the try - catch statement to trap errors...

how and where can I add my own custom code to email me the exception by overriding or extending the System.Exception class or namespace?

Idon't want to write that email code each time I use Catch...
Try

Catch (Exception ex)

Finally

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
I'd suggest writting a utility class that does logging and alerts.  You can include this utility project in your other projects.  Then just make a call to a function in that utility assembly that sends an email.
If you wanted you could set up that exception to send an email when it is created (i.e. in the constructor).

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial