Table of Contents
1 Getting started 7
Introducing Visual Basic 8
Installing Visual Studio 10
Exploring the IDE 12
Starting a new project 14
Adding a visual control 16
Adding functional code 18
Saving projects 20
Reopening projects 21
Summary 22
2 Setting properties 23
Form properties 24
Meeting the properties editor 25
Editing property values 26
Coding property values 28
Applying computed values 30
Applying user values 32
Prompting for input 34
Specifying dialog properties 36
Summary 38
3 Using controls 39
Tab order 40
Using Button 41
Using TextBox 42
Using ComboBox 43
Using Label 44
Using PictureBox 45
Using ListBox 46
Using CheckBox 48
Using RadioButton 49
Using WebBrowser 50
Using Timer 52
Summary 54
4 Learning the language 55
Elements of a program 56
Declaring variable types 58
Understanding variable scope 60
Working with variable arrays 62
Performing operations 64
Branching code 66
Looping code 68
Calling object methods 70
Creating a sub method 72
Sending parameters 73
Creating a function 74
Doing mathematics 75
Generating a random number 76
Summary 78
5 Building an application 79
The program plan 80
Assigning static properties 82
Designing the Interface 84
Initializing dynamic properties 86
Adding runtime functionality 88
Testing the program 90
Deploying the application 92
Summary 94
6 Solving problems 95
Real-time error detection 96
Fixing runtime errors 98
Debugging code 100
Setting debug breakpoints 102
Anticipating logic errors 104
Catching runtime errors 106
Getting help 108
Summary 110
7 Extending the interface 111
Color, Font, & Image dialogs 112
Open, Save, & Print dialogs 114
Creating application menus 116
Making menus work 118
Adding more forms 120
Controlling multiple forms 122
Playing sounds 124
Playing multimedia 126
Summary 128
8 Scripting with Visual Basic 129
Introducing VBA macros 130
Creating a Word macro 132
Creating an Excel macro 134
Running advanced macros 135
An introduction to VBScript 138
Enforcing declarations 139
Validating input 140
Merging text files 142
Getting registry data 144
Summary 146
9 Harnessing data 147
Reading text files 148
Streaming lines of text 150
Reading Excel spreadsheets 152
Reading XML files 154
Creating an XML dataset 156
Reading RSS feeds 158
Addressing XML attributes 160
Summary 162
10 Employing databases 163
An introduction to databases 164
Designing a database 166
Creating a database 168
Adding database tables 170
Defining table columns 172
Making table relationships 174
Entering table data 176
Creating a database dataset 178
Adding form data controls 180
Binding meaningful data 182
Building custom SQL queries 184
Summary 186
Index 187