Using Exception Handling

The following sections work through a series of examples, adding increasingly complex error-handling features to the sample code you've seen already. Starting with a scenario in which you've added no exception handling code at all, these examples introduce the concepts of trapping and identifying exceptions.


We'll use the terms exception handling and error handling to mean the same thing—that is, code you add to a procedure so that it can manage runtime errors as they occur.

All the examples use the same basic premise: Your goal is to open a file, retrieve its length, and then close the file. Each example uses this code to do its job, retrieving the filename from a text box (txtFileName) on the sample form named ...

Get ASP.NET Developer's JumpStart 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.