Database Reference
In-Depth Information
Try It: Causing an Exception to Occur and Observing the Behavior
In this exercise, you'll continue to use the created application and then create a situation that will cause
the exception to occur so you can observe the behavior.
1.
Open the FileHandling project in Visual Studio 2012.
2.
To cause an exception, you will perform only a file-read operation on the
precreated file.
3.
This time, you will run the application from the file
Chapter11.exe
, which is
located in the project's
bin\debug
folder, as shown in Figure 11-5.
Figure 11-5.
Running the program from its designated
.exe
from
bin\debug
4.
When the application loads, enter the following path in the Enter File Read
Path text box:
c:\vidyavrat\MyLogFile.log
. As you probably recall, you saved
the file as
MyFile.log
(refer to the earlier Figure11-2), but here you are
intentionally passing the wrong file name, as shown in Figure 11-6.