From the course: Visual Basic Essential Training

Unlock this course with a free trial

Join today to access over 24,500 courses taught by industry experts.

The default response to unhandled exceptions

The default response to unhandled exceptions - Visual Basic Tutorial

From the course: Visual Basic Essential Training

The default response to unhandled exceptions

- [Instructor] I have an application for demonstrating unhandled exceptions. We'll look at what happens when debugging the application versus what happens when the application is deployed. The way it's going to work is I have these three buttons on the user control. This first button when I click on it will attempt to open a file and read the contents and place the contents in this text box. The second button will attempt to open a file that doesn't exist, so that will cause an exception, and the third button causes a division by zero exception. Now, the code is in a file called ErrorMaker, and that's this file here. The first function I'm calling is OpenFile, that takes a file name, and the way we open a file and read the contents depends on what kind of contents we're reading, but this is reading a text file. So I start by creating what's called a StreamReader, and then I go to the file class and I say, I want to open a text file and I give it the file name. That gives me the reader…

Contents