June 2006
Intermediate to advanced
1344 pages
42h 52m
English
First we demonstrate what happens when errors arise in a console application that does not use exception handling. Figure 12.1 inputs two integers from the user, then divides the first integer by the second using integer division to obtain an Integer result. In this example, we will see that an exception is thrown (i.e., an exception occurs) when a method detects a problem and is unable to handle it.
1 ' Fig. 12.1: DivideByZeroNoExceptionHandling.vb 2 ' An application that attempts to divide by zero. 3 Module DivideByZeroNoExceptionHandling 4 Sub Main() 5 ' get numerator and denominator 6 Console.Write("Please enter an integer numerator: ... |
Read now
Unlock full access