About the Book
Real-world developer training for results
on the job—and on the exam.
Build real-world programming skills—and
prepare for the Microsoft® Certified Professional (MCP) exam—with this
single training kit. Work at your own pace through this system of lessons
and hands-on labs to construct a full-featured desktop application; then
extend its functionality—and your expertise—through additional skill-building
exercises. As you gain practical experience with essential Visual Basic®
6.0 programming tasks, you’re also preparing for MCP exam 70-176, one of
three core credits for the Microsoft Certified Solution Developer certification.
Make this official Microsoft training kit your first step to career advancement!
Coverage includes:
• Installing and configuring the Visual
Basic 6.0 development environment
• Designing applications for performance,
maintainability, extensibility, and availability
• Creating user services—navigation, menus,
data input forms, dialog boxes, callback procedures, and online help
• Building and managing COM components—ActiveX®
controls, DLLs, and documents—for business rules or logic
• Developing data services with ADO
• Testing and debugging solutions
• Planning and implementing deployment
through various media and modes
• Application support—handling errors,
updates, and maintenance
Here’s what’s inside.
• A comprehensive training manual that
maps to MCSD Exam 70-176 goals and objectives
• Hands-on lab exercises plus sample code
on CD-ROM
• Sample exam questions from Self Test
Software, the premier certification test-prep organization
• Learn Microsoft Visual Basic 6.0 Now
multimedia training on CD-ROM for fundamental skills review
Related Books
MCAD/MCSD Self-Paced Training Kit: Implementing Security for Applications with Microsoft® Visual Basic® .NET and Microsoft Visual C#® .NET
MCAD/MCSD Self-Paced Training Kit: Developing Web Applications with Microsoft® Visual Basic® .NET and Microsoft Visual C#® .NET, Second Edition
MCAD/MCSD Self-Paced Training Kit: Developing Windows®-Based Applications with Microsoft® Visual Basic® .NET and Microsoft Visual C#® .NET, Second Ed
Table of Contents
About This Book
xv
Intended
Audience xv
Prerequisites
xvi
Getting
Started xvi
Hardware Requirements xvi
Software Requirements xvii
Course
Overview xvii
Features of This Book xviii
Conventions Used in This Book xix
About The CD-ROM xx
Using
this Book to Prepare for Certification xxii
Where to Find Specific Skills in This Book xxii
The Microsoft
Certified Professional Program xxvi
Microsoft Certification Benefits xxvi
Technical Support xxvii
About
the Authors xxviii
CHAPTER 1: Planning the Design of an
Application 1
About This Chapter 1
Before You Begin 1
Lesson
1: Using the Microsoft Solutions Framework 2
Overview of Microsoft Solutions Framework 2
Microsoft Solutions Framework Models 2
Design Phases of the Solution Design Model 4
Your Role as a Developer 6
Logical Design Tasks 6
Lesson Summary 8
Lesson
2: Designing a System Architecture 10
Understanding Application Structure 10
Single-tier Applications 11
Two-tier Applications 11
Multi-tier Applications 12
Lesson Summary 13
Lesson
3: Using Visual SourceSafe 14
Overview of Visual SourceSafe 14
Practice: Adding Visual SourceSafe to Visual Basic 15
Visual SourceSafe Components 15
Managing Files in VSS 16
Reusing Visual SourceSafe Files 17
Using Administration Tools 19
Lesson Summary 21
Summary
22
Lab:
Using the Microsoft Solutions Framework 24
Microsoft Solutions Framework 24
The Chateau St. Mark Hotel Reservation System 24
Review
27
CHAPTER 2: Creating the User Interface
29
About This Chapter 29
Before You Begin 29
Lesson
1: User Interface Design Principles 30
Composition 31
Color 34
Images and Icons 34
Fonts 35
Menus 35
Lesson Summary 36
Lesson
2: Managing Forms 37
Adding a Form to a Project 37
Using Form Events 38
Using Form Methods 42
Using the Forms Collection 44
Lesson Summary 45
Lesson
3: Using Controls 47
Working with Controls 47
Using Control Arrays 51
Practice: Using Controls Arrays 55
Using the Controls Collection 58
Practice: Using the Add Method with a Controls Collection 58
Enhancing the User Interface 60
Lesson Summary 68
Lesson
4: Using Menus 69
Creating Menus at Design Time 69
Modifying Menus at Run Time 74
Lesson Summary 78
Summary
79
Lab:
Creating the Chateau St. Mark User Interface 81
Exercise 1: Creating the User Interface 82
Exercise 2: Adding Custom Controls to the Form 84
Exercise 3: Adding a Menu Bar 87
Review
90
CHAPTER 3: Validating and Processing
User Input 93
About This Chapter 93
Before You Begin 93
Lesson
1: Overview of Validation 94
The Importance of Validation 94
Types of Validation 95
Providing User Feedback 95
Using the SetFocus Method 96
Using the LostFocus Event 97
Lesson Summary 97
Lesson
2: Implementing Form-Level Validation 98
Overview of Form-Level Validation 98
Form-Level Keyboard Handler 99
Enabling and Disabling Controls Based on Input 100
Practice: Enabling and Disabling Controls 101
Lesson Summary 103
Lesson
3: Implementing Field-Level Validation 104
Using the Textbox Control Properties 104
Using Events for Field-Level Validation 105
Validation Functions 108
Using the Masked Edit Control 108
The Validate Event 111
Practice: Using the Validate Event with CausesValidation Property 112
Lesson Summary 115
Summary
116
Lab:
Adding Field and Form Level Validation 118
Exercise 1: Controlling User Navigation 118
Exercise 2: Field-Level Validation 120
Exercise 3: Using the Validate and LostFocus Events 121
Exercise 4: Form-Level Validation 122
Review
124
CHAPTER 4: Using the Debugging Tools
125
About This Chapter 125
Before You Begin 125
Lesson
1: Debugging Your Application 126
Types of Errors 126
The Debug Menu (Toolbar) 128
Lesson Summary 133
Lesson
2: Testing Your Application 134
The Immediate Window 134
Using the Debug Object 137
Using the Locals Window 138
Setting Watch Expressions 139
The Call Stack Dialog Box 142
Lesson Summary 143
Summary
144
Lab:
Debugging an Application 146
Review
151
CHAPTER 5: Implementing Error Handling
153
About This Chapter 153
Before You Begin 153
Lesson
1: Creating an Error Handler 154
How Visual Basic Handles a Run-Time Error 154
Implementing a Local Error Handler 154
Practice: Creating an Error Handler 156
Errors-Calling Chain 158
Disabling an Error Handler 159
Visual Basic Error Handling Options 160
Lesson Summary 161
Lesson
2: Using Inline Error Handling 162
Creating an Inline Error Handler 162
Disabling an Inline Error Handler 163
Lesson Summary 163
Lesson
3: Implementing Centralized Error Handling 164
Creating a Centralized Error Handler 164
Lesson Summary 165
Summary
166
Lab:
Implementing Error Handling 167
Exercise 1: Implementing Procedural Error Handling 167
Exercise 2: Implementing Inline Error Handling 169
Review
171
CHAPTER 6: Introduction to Class Modules
173
About This Chapter 173
Before You Begin 173
Lesson
1: Introduction to COM 174
Component Object Model 174
Class Modules 176
Creating COM Components With Visual Basic 177
Lesson Summary 178
Lesson
2: Using Class Modules 179
Adding A Class Module to a Project 179
Creating Objects from Components 181
Lesson Summary 182
Lesson
3: Creating Class Modules 183
Creating Property Procedures 183
Practice: Designing a Class Module 184
Creating Methods 186
Using the CHouse Class 186
Creating Events 187
Declaring Custom Events 187
Handling Events 188
Lesson Summary 189
Lesson
4: Using the Class Builder 190
Loading the Class Builder 190
Creating a New Class 190
Object Models 191
Lesson Summary 193
Summary
194
Lab:
Creating Class Modules 196
Exercise 1: Creating Class Modules with the Class Builder 196
Review
199
CHAPTER 7: Introduction to ActiveX
Documents 201
About This Chapter 201
Before You Begin 201
Lesson
1: How Visual Basic Accesses Data 202
Data Access Interfaces 202
Relational Database Concepts 204
Lesson Summary 207
Lesson
2: Introduction to OLE DB and ADO 208
What Is OLE DB? 208
Components of OLE DB 209
How OLE DB Relates To ADO 210
Lesson Summary 210
Lesson
3: Overview of Structured Query Language 211
The SQL Select Statement 211
Lesson Summary 214
Lesson
4: The ADO Data Control 215
Using the ADO Data Control 215
Connecting to a Data Source 216
Practice: Connecting an ADO Data Control to a Data Source 220
Binding Controls 222
Practice: Binding Controls 223
Using the Data Form Wizard 224
Lesson Summary 226
Lesson
5: Coding the ADO Data Control 227
Creating a Recordset 227
Modifying Records in a Recordset 228
Adding Records to a Recordset 228
Deleting Records from a Recordset 228
Searching for Records 229
Practice: Searching for Records in a Recordset 231
Lesson Summary 232
Summary
234
Lab:
Using the ADO Data Control 236
Exercise 1: Connecting to a data source 236
Exercise 2: Binding controls to the ADO Data control 238
Review
241
CHAPTER 8: Developing Solutions Using
ADO 243
About This Chapter 243
Before You Begin 243
Lesson
1: Introducing the ADO Object Model 244
ADO Objects 244
ADO Collections 246
Lesson Summary 246
Lesson
2: Connecting to a Data Source 247
Using a Connection Object 247
Creating a Connection Object in Code 248
Practice: Creating a Connection with Code 249
Connection Events 250
Lesson Summary 252
Lesson
3: Retrieving Data 253
Retrieving Records with a Recordset Object 253
Retrieving Records with a Command Object 256
Practice: Returning Records from a Database 258
Lesson Summary 259
Lesson
4: Navigating Records 260
Specifying a Cursor Type 260
Presenting Data to the User 261
Navigating the Recordset 262
Finding a Record in a Recordset 263
Lesson Summary 265
Lesson
5: Modifying Data 266
Locking a Recordset 266
Editing a Record 267
Adding a New Record 267
Deleting a Record 268
Lesson Summary 268
Lesson
6: Using the Data Environment 269
Creating a Connection 269
Presenting Records to the User 270
Practice: Presenting Records Using a Data Environment 271
Lesson Summary 273
Summary
274
Lab:
Using ActiveX Data Objects 276
Exercise 1: Creating ADO Objects 276
Exercise 2: Writing ADO Code 278
Review
281
CHAPTER 9: Connectiong to COM Servers
283
About This Chapter 283
Before You Begin 283
Lesson
1: Connecting to COM Components 284
Review of COM Components 284
Registering a Component 284
Using Type Libraries 286
Setting References 287
Lesson Summary 287
Lesson
2: Managing COM Components 289
Overview of Automation 289
Declaring Object Variables 290
Instantiating an Object 291
Practice: Automating Microsoft Excel 293
Using the Object Browser 295
Lesson Summary 296
Lesson
3: Calling Win32 APIs 297
COM Components and Win32 DLLs 297
Extending Applications with the Win32 API 298
Creating Callback Procedures 301
Practice: Creating a Callback Procedure 303
Lesson Summary 305
Summary
307
Lab:
Connecting to COM Components 309
Exercise 1: Connecting to Microsoft Word 309
Exercise 2: Connecting to Microsoft Excel 312
Review
315
CHAPTER 10: Creating and Managing COM
Components 317
About This Chapter 317
Before You Begin 317
Lesson
1: Overview of Creating COM Components 318
Designing COM Components 318
In-Process vs. Out-of-Process Components 319
Component Project Templates 320
Lesson Summary 321
Lesson
2: Creating ActiveX Controls 322
What Is an ActiveX Control? 322
Control Classes 323
Practice: Creating an ActiveX Control 325
Implementing Your ActiveX Control 326
Practice: Testing Your ActiveX Control 331
Making Your ActiveX Control a Data Source 333
Practice: Creating a Data Source Control 334
Lesson Summary 338
Lesson
3: Creating ActiveX Code Components 339
Understanding Code Components 339
Creating an ActiveX Code Component 340
Practice: Creating an ActiveX DLL 341
The Instancing Property 343
Testing and Debugging 346
Lesson Summary 349
Lesson
4: Using the Visual Component Manager 350
Overview of Visual Component Manager 350
Installing and Starting Visual Component Manager 353
Publishing Components 353
Finding Components 356
Reusing Components 357
Lesson Summary 358
Summary
359
Lab:
Creating a Data-Aware Class 361
Lesson 1: Making the CReservation Class a Data Source 361
Exercise 2: Binding Controls to the CReservation class 362
Exercise 3: Creating Recordset Navigation Controls 363
Exercise 4: Implementing Reservation Processing Functionality 365
Review
371
CHAPTER 11: Creating Internet Applications
373
About This Chapter 373
Before You Begin 374
Lesson
1: Creating DHTML Applications 375
Review of the Internet and HTML 375
Visual Basic and Internet Development 375
Introduction to DHTML Applications 376
Modifying HTML with DHTML 378
Practice: Creating a DHTML Application 379
Lesson Summary 382
Lesson
2: Creating ActiveX Documents 383
Overview of ActiveX Documents 383
The UserDocument Object 384
Creating an ActiveX Document 386
Practice: Creating an ActiveX Document 388
Running and Debugging an ActiveX Document Project 391
Lesson Summary 391
Lesson
3: Creating IIS Applications Using WebClasses 393
Overview of IIS Applications 393
Using a WebClass to Respond to Client Requests 395
Using the WebClass Designer 397
Writing Code for a WebClass 399
Debugging and Deploying Your IIS Application 399
Integration Between Visual Basic and Other Web Tools 400
Lesson Summary 401
Summary
402
Lab:
Creating ActiveX Documents 404
Exercise 1: Converting Forms to ActiveX Documents 404
Review
407
CHAPTER 12: Packaging and Deploying
an Application 409
About This Chapter 409
Before You Begin 409
Lesson
1: Implementing Online Help 410
Properties of Help Files 410
Implementing ToolTips 413
Lesson Summary 414
Lesson
2: Creating an Executable 415
Compiler Options 415
Using Conditional Compilation 420
Lesson Summary 422
Lesson
3: Using the Package and Deployment Wizard 423
Installing a Desktop Application 423
The Setup Toolkit 426
Allowing for Uninstall 427
Lesson Summary 428
Summary
429
Lab:
Using Help Files and the Package and Deployment Wizard 430
Exercise 1: Applying Help Files 430
Exercise 2: Setting Compile Options in your Application 432
Exercise 3: Using the Package and Deployment Wizard 433
Review
435
Appendix: Questions
and Answers 437
Glossary 457
Index 473 |