From the course: Visual Basic Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

What happens when the unexpected happens?

What happens when the unexpected happens? - Visual Basic Tutorial

From the course: Visual Basic Essential Training

Start my 1-month free trial

What happens when the unexpected happens?

- [Instructor] All frameworks provide a way to signal failure to the calling code. .NET uses exceptions for this purpose. For an exception to be handled properly, it helps to understand that there are two participants, the exception originator is the developer who wrote the code that cannot complete its job. They'll throw an exception to indicate this. The other participant is the exception consumer. This programmer is using the library code and something goes wrong. They handle the exception. Both roles are important. Without the originator, we don't know anything is wrong. Without the consumer, the application crashes. In this chapter, we'll focus on the second role. We'll look at how to write the handler code. From the originator side, when something goes wrong, say the content of a file stream are corrupt and the code cannot finish reading the file. They use exceptions to report the runtime problem in the code.…

Contents