Handling Exceptions

Implement error handling in the user interface:

  • Create and implement custom error messages.

  • Raise and handle errors.

Abruptly terminating a program when an exception occurs is not a good idea. An application should be able to handle an exception and, if possible, try to recover from it. If recovery is not possible, you can have the program take other steps, such as notify the user and then gracefully terminate the application.

The .NET Framework allows exception handling to interoperate among languages and across machines. You can catch exceptions thrown by code written in one .NET language in a different .NET language. The .NET framework also allows you to handle exceptions thrown by legacy Component Object Model (COM) applications ...

Get MCAD/MCSD.NET Training Guide (Exam 70-316): Developing and Implementing Windows®-Based Applications with Microsoft® Visual C#™ .NET and Microsoft® Visual Studio® .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.