| Acknowledgments | xv |
| Introduction | xvii |
Part 1 | Introduction to Visual Basic .NET | |
1 | What Is Visual Basic .NET? | 3 |
| Visual Basic .NET Defined | 5 |
| Visual Basic .NET Is a Programming Language | 5 |
| Visual Basic .NET Is Used for Writing Windows Applications | 8 |
| Windows Applications Are Gooey | 9 |
| Windows Applications Are Event-Driven | 11 |
| The Visual Basic .NET Programming Language Is Object-Oriented | 13 |
| Properties | 14 |
| Methods | 15 |
| Events | 15 |
| Programming with Class | 16 |
| It's Not Just Visual Basic, It's Visual Basic .NET | 17 |
| Summary | 19 |
| Mastery Check | 20 |
2 | Create A Visual Basic .NET Program Without Writing Code | 23 |
| The .NET Framework | 25 |
| Before You Install Visual Studio .NET | 26 |
| Visual Studio .NET Versions | 27 |
| Visual Studio .NET System Requirements | 27 |
Project 2-1 | Installing Visual Studio .NET | 28 |
| Starting and Customizing Visual Studio .NET | 34 |
Project 2-2 | Creating a Windows Application | 38 |
| The Code Behind the Scenes | 44 |
| Class and Inherits Statements | 46 |
| New Method | 47 |
| Initialize Component Method | 48 |
| Dispose Method | 50 |
| Region Directive | 52 |
| Summary | 53 |
| Mastery Check | 54 |
3 | Event Procedures, Properties, and Controls | 57 |
| Event Procedures | 58 |
| When Are Event Procedures Necessary? | 59 |
| Using the IDE to Create an Event Procedure | 61 |
| Writing Code Inside the Event Procedure | 64 |
| Viewing and Changing Properties | 70 |
| Using the Forms Designer to View and Change Properties | 71 |
| Viewing and Changing Properties Through Code | 75 |
| Adding Controls to the Form | 76 |
| The Toolbox | 76 |
| Copying the Control from the Toolbox to the Form | 79 |
| Changing the Control's Size and Location Using the Forms Designer | 80 |
| The Code Behind the Scenes | 81 |
Project 3-1 | Using the Label Control | 82 |
| Summary | 85 |
| Mastery Check | 86 |
Part 2 | Programming Building Blocks: Variables, Data Types, and Operators | |
4 | Variables and Data Types | 91 |
| Data Types | 92 |
| Bits and Bytes | 94 |
| Numeric Data Types | 96 |
| Character Data Types | 100 |
| Miscellaneous Data Types | 100 |
| Default Values | 101 |
| Variables | 103 |
| Option Explicit | 103 |
| Option Strict | 105 |
| Scope | 106 |
| Declaring a Variable | 108 |
Project 4-1 | Shared Variable | 114 |
| Constants | 118 |
| Summary | 121 |
| Mastery Check | 122 |
5 | Assignment and Arithmetic Operators | 125 |
| The Assignment Operator | 126 |
| The Location of the Assignment Statement | 127 |
| The Left Side of the Assignment Statement | 127 |
| The Right Side of the Assignment Statement | 128 |
| Type Conversions | 130 |
| Widening Conversions | 130 |
| Narrowing Conversions | 131 |
| The Effect of Option Strict on Conversions | 133 |
| Type Conversion Keywords | 133 |
| Arithmetic Operators | 136 |
| The Division Operators | 137 |
| Concatenation Operators | 138 |
| Type Conversions Revisited | 139 |
| Operator Precedence | 141 |
| Combining Arithmetic and Assignment Operators | 142 |
Project 5-1 | Change Machine Project | 143 |
| The InputBox Function and Return Value | 145 |
| The Algorithm | 147 |
| Outputting the Result | 148 |
| Summary | 149 |
| Mastery Check | 149 |
6 | Comparison and Logical Operators | 153 |
| Comparison Operators | 155 |
| Comparing Objects | 157 |
| Comparing Strings | 158 |
| Precedence | 162 |
| Logical Operators | 163 |
| The And Operator | 163 |
| The AndAlso Operator | 164 |
| The Or Operator | 165 |
| The OrElse Operator | 166 |
| The Xor Operator | 166 |
| The Not Operator | 167 |
| Precedence | 167 |
| Summary | 168 |
| Mastery Check | 170 |
Part 3 | Controlling the Flow of the Program | |
7 | Control Structures | 175 |
| If Statements | 176 |
| The If...Then Statement | 177 |
| The If...Then...Else Statement | 178 |
| The IIf Function | 179 |
| The If...Elself Statement | 180 |
| Controls Used for If Statements | 182 |
| CheckBox Control | 182 |
| RadioButton Control | 182 |
Project 7-1 | Tuition Calculator | 183 |
| The Select Case Statement | 190 |
Project 7-2 | Arithmetic Calculator | 193 |
| Summary | 197 |
| Mastery Check | 197 |
8 | Loops and Arrays | 201 |
| Loop Structures | 202 |
| The For...Next Statement | 202 |
| The While...End While Statement | 206 |
| The Do Statement | 208 |
| Arrays | 211 |
| Declaring an Array | 212 |
| Useful Array Functions, Properties, and Methods | 215 |
| Resizing an Array | 217 |
| The For Each...Next Statement | 219 |
Project 8-1 | Day of Week Calculator | 222 |
| Summary | 228 |
| Mastery Check | 229 |
9 | Procedures | 231 |
| Types of Procedures | 232 |
| Built-in vs. Programmer-defined Procedures | 233 |
| Methods Contrasted | 233 |
| Subroutines | 235 |
| Declaring a Subroutine | 235 |
| Calling the Subroutine | 240 |
| Arguments | 241 |
| Functions | 245 |
| Declaring Functions | 245 |
| Calling Functions | 248 |
| More on Arguments | 251 |
| Passing Arguments ByVal and ByRef | 251 |
| Optional Arguments | 255 |
| Parameter Arrays | 258 |
| Procedure Overloading | 261 |
Project 9-1 | Calculator, Version 2 | 264 |
| Summary | 267 |
| Mastery Check | 268 |
Part 4 | The User Interface | |
10 | Helper Forms | 275 |
| Message Boxes | 277 |
Project 10-1 | Message Boxes | 278 |
| Dialog Boxes | 285 |
Project 10-2 | Dialog Box | 285 |
| Owned Forms | 296 |
Project 10-3 | Owned Form | 297 |
| Summary | 306 |
| Mastery Check | 308 |
11 | Menus and Toolbars | 311 |
| Menus | 312 |
| Creating a Menu | 312 |
| Add Functionality to the Menu Items | 318 |
| Enhancing the Menu | 320 |
| Disabling Items on Windows Forms Menus | 323 |
| Context Menu | 324 |
| Creating a Context Menu | 326 |
| Adding Items to the Context Menu | 328 |
| Add Functionality to the Menu Items | 333 |
| Toolbars | 335 |
| Adding the Toolbar and Buttons | 335 |
| Defining an Icon for a Toolbar Button | 339 |
| Adding Functionality to the Toolbar | 343 |
Project 11-1 | Text Editor | 346 |
| Summary | 348 |
| Mastery Check | 349 |
Part 5 | Error Handling and Prevention | |
12 | Structured Exception Handling and Debugging | 355 |
| Structured Exception Handling | 357 |
| Exceptions | 357 |
| Structured vs. Unstructured Exception Handling | 358 |
| The Try...Catch...Finally Statement | 358 |
Project 12-1 | Illegal Division | 360 |
| Exception Classes | 362 |
| Debugging | 364 |
| Break Mode | 366 |
| Starting Debugging | 366 |
| Controlling the Flow During Debugging | 374 |
| Debugging Tools | 379 |
| Summary | 385 |
| Mastery Check | 387 |
| Answers to Mastery Checks | 389 |
Module 1 | What Is Visual Basic .NET? | 390 |
Module 2 | Create A Visual Basic .NET Program Without Writing Code | 391 |
Module 3 | Event Procedures, Properties, and Controls | 392 |
Module 4 | Variables and Data Type | 393 |
Module 5 | Assignment and Arithmetic Operators | 393 |
Module 6 | Comparison and Logical Operators | 394 |
Module 7 | Control Structures | 395 |
Module 8 | Loops and Arrays | 396 |
Module 9 | Procedures | 397 |
Module 10 | Helper Forms | 399 |
Module 11 | Menus and Toolbars | 400 |
Module 12 | Structured Exception Handling and Debugging | 401 |
| Index | 403 |