| Chapter 3- Data Types and Operators | Boolean Expressions Page 2 3 4 |
| The If Statement Page 2 3 4 5 6 7 8 9 | |
| Arithmetic Operations Page 2 3 4 5 6 | Boolean Operators and Nested If Statements Page 2 3 4 5 6 7 |
| Events and Sequential Processing Page 2 3 4 5 | More Examples Page 2 3 4 5 6 7 8 9 10 11 12 |
| Datatypes and Conversions Page 2 3 4 5 6 7 | Using Check Box and Option Controls Page 2 3 4 5 6 7 8 9 10 |
| Variable Declarations - Local and Global Page 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | Exercises Page 2 3 4 5 6 7 8 |
| Chapter 4- Selection Statements | Review Questions |
| Introduction | |
3-2: Arithmetic Operators (continued)
Exercise 3-1: Calculating the Area of a Circle - Testing the Program
Start debugging your program and perform the following tests:
So cases iii and v are problematic indicating that, even in a very simple program such as this, things are perhaps not quite as simple as they might seem.
Case v results in the VB environment displaying information about something called an unhandled exception. Figure 3-3 shows the screen snapshot and the message InvalidCastException was unhandled. There is lots of further information and the environment highlights the offending line of code. For now simply note the line that says Conversion from String "" to type 'Double' is not valid. We'll discuss information in the next few sections that helps make sense of this.
Figure 3-3: A runtime exception
For now all we can do about this error is stop the debugging, so from the Debug menu select Stop Debugging.