Cover image for 1001 Visual Basic programmer's tips
1001 Visual Basic programmer's tips
Coombs, Ted.
Personal Author:
Second edition.
Publication Information:
Albany, NY : Onword Press Thomson Learning, [2001]

Physical Description:
1 volume (unpaged) : illustrations ; 24 cm + 1 computer optical disc (4 3/4 in.)
General Note:
Rev. ed. of: 1001 Visual Basic programmer's tips / Kris A. Jamsa. c1997.

Includes index.
Title Subject:
Format :


Call Number
Material Type
Home Location
Item Holds
QA76.73.B3 J368 2001 Book and Software Set Non-Fiction Area

On Order



1001 Visual Basic Programmer's Tips, 2E takes programmers from square one with Visual Basic 6. Building upon the basics, this new edition features expanded coverage of Visual Basic Script, including a focus on Active Server Pages for programmers to create web pages. Also introduced in this edition is a new section on Lightweight Directory Access Protocol - a new object-oriented way of storing data. All in all, this book covers the entire Visual Basic 6, making it the optimal choice for both new and professional programmers alike.

Table of Contents

An Introduction to Programmingp. 1
How Visual Basic Stores Source Filesp. 2
Creating an Executable Programp. 3
Getting Started with the New Project Dialog Boxp. 4
Using the New Application Wizardp. 5
Understanding Interface Typesp. 6
Using the VB Application Wizard to Create a Project Frameworkp. 7
Selecting an Interface Type in VB Application Wizardp. 8
Understanding Radio Buttonsp. 9
Selecting Menus in Application Wizardp. 10
Using the Application Wizard to Create a Toolbarp. 11
Using the Application Wizard to Add Resource Filesp. 12
Using the Wizard to Add An Internet Connectionp. 13
Understanding Controlsp. 14
Including Standard Formsp. 15
Connecting to Databases Using the Wizardp. 16
Finishing the Creation of Your New Wizard--Generated Projectp. 17
Reading The VB Application Wizard's Summary Reportp. 18
Saving Your New Wizard-Generated Projectp. 19
Creating Fully Executable Files Without Entering Any Codep. 20
Understanding the Editing Windowp. 21
Understanding The Toolboxp. 22
Understanding The Properties Windowp. 23
Understanding The Project Explorerp. 24
Understanding The Form Layout Windowp. 25
Understanding The Editing Display Windowp. 26
Understanding Icons On the Toolbarp. 27
Introducing the Visual Basic Menu Barp. 28
Using the File Menup. 29
Using the Edit Menup. 30
Using the View Menup. 31
Using the Project Menup. 32
Using the Format Menup. 33
Using the Debug Menup. 34
Using the Run Menup. 35
Using the Tools Menup. 36
Using the Add-Ins Menup. 37
Creating Formsp. 38
Naming Formsp. 39
Creating Codep. 40
Understanding the End Statementp. 41
Running Your Visual Basic Programp. 42
Changing Form Captionsp. 43
Using the Me Objectp. 44
Creating an Executable from Your Codep. 45
Understanding Syntax Errorsp. 46
Structuring a Visual Basic Programp. 47
Writing Your Second Programp. 48
Changing the Autosave Optionp. 49
Defining Just-In-Time Compilationp. 50
Saving Project Filesp. 51
Understanding Proceduresp. 52
Adding Statements to Your Programp. 53
Displaying Output On a New Linep. 54
Using the Visual Basic Constantsp. 55
Visual Basic Does Not Consider Casep. 56
Understanding Logic Errors (Bugs)p. 57
Trapping Errors in Your Programsp. 58
Breaking on All Errorsp. 59
Understanding the Program Development Processp. 60
Commenting Your Programsp. 61
Improving Your Program Readabilityp. 62
Using Comments to Exclude Program Statementsp. 63
Beginning to Understand Scopep. 64
Understanding the Way Windows Messages are Handledp. 65
Maintaining Rigid Control of the Interfacep. 66
Understanding Variablesp. 67
Using The Dim Statementp. 68
Declaring Module- and Form-Level Variablesp. 69
Declaring Procedure Variablesp. 70
Reconciling Variable Name Conflictsp. 71
Using the Public Keyword with Variablesp. 72
Assigning a Value to a Variablep. 73
Understanding Variable Typesp. 74
Declaring Multiple Variables of the Same Typep. 75
Commenting Your Variables at Declarationp. 76
Using Meaningful Variable Namesp. 77
Understanding Visual Basic's Keywordsp. 78
Understanding the Option Explicit Statementp. 79
Understanding the Option Base Statementp. 80
Understanding Variables of Type Integerp. 81
Understanding Variables of Type Longp. 82
Understanding Variables of Type Stringp. 83
Understanding Variables of Type Fixed-Length Stringp. 84
Understanding Variables of Type Singlep. 85
Understanding Variables of Type Booleanp. 86
Understanding Variables of Type Bytep. 87
Understanding Variables of Type Currencyp. 88
Understanding Variables of Type Datep. 89
Understanding Variables of Type Doublep. 90
Understanding Variables of Type Objectp. 91
Understanding Variables of Type Variantp. 92
Understanding Control Typesp. 93
Why Visual Basic Does Not Use Pointersp. 94
Assigning Values to Floating-Point Variablesp. 95
Assigning Values to Variables of Type Integer and Longp. 96
Assigning Values to Variables of Type Stringp. 97
Assigning Values to Variables of Type Fixed-Length Stringp. 98
Assigning Values to Variables of Types Single and Doublep. 99
Assigning Values to Variables of Type Booleanp. 100
Assigning Values to Variables of Type Bytep. 101
Assigning Values to Variables of Type Currencyp. 102
Understanding Variables of Type Objectp. 103
Assigning Values to Variables of Type Datep. 104
Understanding Overflowp. 105
Understanding Precisionp. 106
Assigning Quotes and Other Charactersp. 107
Using the Chr Functionp. 108
Using Debug.Print to Output Informationp. 109
Using the Str Functlon to Convert a Number to a Stringp. 110
Using the Format Function to Convert a Number to a Stringp. 111
Using the Format Function to Convert a Date to a Stringp. 112
Basic Math Operations in Visual Basicp. 113
Understanding Modulo Arithmeticp. 114
Understanding Operator Precedencep. 115
Forcing the Order of Operator Evaluationp. 116
Adding and Subtracting Valuesp. 117
Understanding a Bitwise Or Operationp. 118
Understanding the Xor Operatorp. 119
Understanding a Bitwise And Operationp. 120
Understanding a Bitwise Eqv Operationp. 121
Understanding a Bitwise Imp Operationp. 122
Introducing Conditional Processingp. 123
Introducing Iterative Processingp. 124
Understanding How Visual Basic Represents True and Falsep. 125
Testing a Condition With If-Thenp. 126
Understanding the Use of Parentheses in Conditional Processingp. 127
Understanding Simple and Compound Statementsp. 128
Testing for Equalityp. 129
Performing Relational Testsp. 130
Performing a Logical And to Test Two Conditionsp. 131
Performing a Logical Or to Test Two Conditionsp. 132
Performing a Logical Not Operationp. 133
Performing a Logical Xor Operationp. 134
Performing a Logical Eqv Operationp. 135
Performing a Logical Imp Operationp. 136
Assigning the Result of a Conditionp. 137
Declaring Variables Within Compound Statementsp. 138
Using Indentation to Improve Readabilityp. 139
Testing Floating-Point Valuesp. 140
Looping Foreverp. 141
Defining Constantsp. 142
Beware of If-If-Elsep. 143
Performing Statements a Specific Number of Timesp. 144
Parts of the For Statement Are Optionalp. 145
Decrementing Values in a For-Next Statementp. 146
Controlling the For-Next Loop Incrementp. 147
For-Next Loops Are not Just for Integer Variablesp. 148
Understanding a Null Loopp. 149
Understanding a DoEvents Loopp. 150
Dangers of an Infinite Loopp. 151
Using Nested For-Next Loopsp. 152
Changing the Control Variable's Valuep. 153
Using Next within a Conditional Statementp. 154
Ending a Loop Using the Exit For Statementp. 155
Repeating One or More Statements Using a Do Loopp. 156
Understanding the Parts of a Do Loopp. 157
Using While-Wend For Loopsp. 158
Always Performing One or More Statements Using the Do loopp. 159
Repeating One or More Statements Using a Do Until Loopp. 160
Ending a Loop Using Exit Dop. 161
Branching with Gotop. 162
Testing Multiple Conditionsp. 163
Understanding the Case Else Statementp. 164
Visualizing a Visual Basic Stringp. 165
How Visual Basic Stores a Stringp. 166
How Visual Basic Stores Variable-Length Stringsp. 167
Understanding Zero-Terminated Stringsp. 168
How A Differs From ap. 169
Using the Option Compare Text Switchp. 170
Determining the Length of a Stringp. 171
Copying One String Variable'sp. 172
Appending One String Variable's Contents to Another String Variablep. 173
Appending n Characters to a String Variablep. 174
Handling Oversized Stringsp. 175
Ignoring Case When Determining Whether Strings Are Equalp. 176
Obtaining the First Occurrence of a Character Within a String Variablep. 177
Finding the Last Occurrence of a Character in a Stringp. 178
Counting the Number of Character Occurrences in a String Variablep. 179
Reversing a String Variable's Contentsp. 180
Comparing Two Character Stringsp. 181
Comparing the First n Characters of Two Stringsp. 182
Converting a String Representation of a Numberp. 183
Locating a Substring Within a Stringp. 184
Returning n Characters from a Point Within the Stringp. 185
Counting the Number of Substring Occurrencesp. 186
Using the TextBox Controlp. 187
Using the Rich TextBox Controlp. 188
Using the Find Method of the Rich TextBox Controlp. 189
Understanding Methodsp. 190
Understanding Focusp. 191
Obtaining the Rightmost Occurrence of a Substringp. 192
Removing a Substring From Within a Stringp. 193
Replacing One Substring with Anotherp. 194
Removing Text Within a Rich TextBox Controlp. 195
Replacing Text Within a Rich TextBox Control with Other Textp. 196
Determining Whether a Character is Alphanumericp. 197
Determining Whether a Character Is a Digitp. 198
Determining Whether a Character Is Upper- or Lowercasep. 199
Determining Whether a String is a Datep. 200
Converting a Character to Uppercase or Lowercasep. 201
Working with ASCII Charactersp. 202
Formatting String Variablesp. 203
Using Select Case with Stringsp. 204
Using a new-line Variablep. 205
Returning Values Using Functionsp. 206
Specifying Parameter Typesp. 207
Understanding Local Variablesp. 208
Understanding Function Overheadp. 209
Reducing Overhead by Declaring Parameter Typesp. 210
Where Visual Basic Places Local Variablesp. 211
Declaring Global Variablesp. 212
Using Public Instead of Globalp. 213
Why You Should Avoid Global Variables Within Your Programsp. 214
Resolving Global and Local Variable Name Conflictsp. 215
Better Defining a Variable's Scopep. 216
Defining Proceduresp. 217
Defining Functionsp. 218
Understanding Call by Valuep. 219
Why Call by Value Prevents Parameter Value Changep. 220
Understanding Call By Referencep. 221
Changing a Parameter's Valuep. 222
Changing Only Specific Parametersp. 223
Call by Reference Still Uses the Stackp. 224
Function Variables that Rememberp. 225
Procedures that Rememberp. 226
How Visual Basic Initializes Static Variablesp. 227
Creating Errors with the Static Keywordp. 228
Understanding Global versus Local Proceduresp. 229
Reusing Proceduresp. 230
Understanding Formal and Actual Parametersp. 231
Understanding Scopep. 232
Using Variant Parameters to Receive Unknown Valuesp. 233
Using Variant Functions to Return Unknown Valuesp. 234
Using VarType with Variant Parametersp. 235
Using the TypeName Member Functionp. 236
Using VarType or TypeName With Returned Valuesp. 237
Updating Global Variables within Functionsp. 238
Using Functions which Change Variables within Arithmetic Expressionsp. 239
Creating Private Procedures on a Formp. 240
Calling Procedures from within Proceduresp. 241
Understanding Recursionp. 241
Understanding the Recursive Factorial Functionp. 243
One More Recursive Examplep. 244
Display Values to Better Understand Recursionp. 245
Direct and Indirect Recursionp. 246
To Use or Not to Use Recursionp. 247
Working With Datesp. 248
Why Recursive Procedures Are Slowp. 249
How to Remove Recursionp. 250
Passing Constants as Parametersp. 251
A Subroutine is a Procedure that Returns No Valuesp. 252
A Subroutine is a Procedure that Returns Multiple Valuesp. 253
Using Procedures Without Parametersp. 254
Understanding Visual Basic's Categories of Scopep. 255
Understanding Name Space and Identifiersp. 256
Understanding Identifier Visibilityp. 257
Understanding Durationp. 258
Functions That Support a Variable Number of Parametersp. 259
Supporting a Variable Number of Parametersp. 260
Creating a Function That Supports Multiple Parameters of Multiple Typesp. 261
Using the Optional Keywordp. 262
Understanding the IsMissing Member Functionp. 263
Using Buffered Inputp. 264
Using Input Box to Receive Inputp. 265
Using the TextBox Control to Perform Buffered Inputp. 266
Reading a Character Using Direct I/Op. 267
Clearing All Fields on The Screenp. 268
Updating a Form's Displayp. 269
Positioning Your Cursor Using SetFocusp. 270
Positioning Your Cursor Using TabIndexp. 271
Displaying Output in Colorp. 272
Controlling Screen Colorsp. 273
Assigning a Background Colorp. 274
Creating a Reusable Math Modulep. 275
Using the Abs Functionp. 276
Using the Cosine/Secantp. 277
Using the Sine/Cosecantp. 278
Using the Arctangentp. 279
Rounding a Floating-Point Value Upp. 280
Working With an Exponentialp. 281
Calculating the Natural Logp. 282
Calculating the Result of log[subscript 10]xp. 283
Determining Maximum and Minimum Valuesp. 284
Breaking a Floating-Point Value into Integer and Fractional Componentsp. 285
Calculating the Result of x[superscript n]p. 286
Generating a Random Numberp. 287
Mapping Random Values to a Specific Rangep. 288
Seeding the Random Number Generatorp. 289
Calculating a Value's Square Rootp. 290
Using the Tangent of an Anglep. 291
Performing a Net Present Value Calculationp. 292
Performing a Rate Calculationp. 293
Creating a Customized Math Error Handlerp. 294
Understanding Arraysp. 295
Declaring an Arrayp. 296
Visualizing an Arrayp. 297
Understanding an Array's Storage Requirementsp. 298
Initializing an Arrayp. 299
Accessing Array Elementsp. 300
Looping Through Array Elementsp. 301
Use Constants to Define Arraysp. 302
Passing an Array to a Functionp. 303
Revisiting Arrays and Functionsp. 304
Passing Arrays to Proceduresp. 305
Determining How Many Elements an Array Can Holdp. 306
Allocating Arrays Dynamicallyp. 307
Creating Arrays From Delimited Stringsp. 308
Understanding Multidimensional Arraysp. 309
Understanding Rows and Columnsp. 310
Accessing Elements in a Two-Dimensional Arrayp. 311
Initializing Elements in a Two-Dimensional Arrayp. 312
Determining the Amount of Memory a Multidimensional Array Consumesp. 313
Looping Through a Two-Dimensional Arrayp. 314
Traversing a Three-Dimensional Arrayp. 315
Passing a Two-Dimensional Array to a Functionp. 316
Understanding How Visual Basic Stores Multidimensional Arraysp. 317
Arrays of Structures of Arraysp. 318
Searching an Array for a Specific Valuep. 319
Understanding a Binary Searchp. 320
Using a Binary Searchp. 321
Sorting an Arrayp. 322
Understanding the Bubble Sortp. 323
Putting a Bubble Sort to Usep. 324
Understanding the Selection Sortp. 325
Putting a Selection Sort to Usep. 326
Understanding the Shell Sortp. 327
Putting a Shell Sort to Usep. 328
Understanding the Quick Sortp. 329
Putting a Quick Sort to Usep. 330
Problems with Previous Sorting Solutionsp. 331
Sorting an Array of Character Stringsp. 332
Sorting Arrays with Quick_Sortp. 333
Searching an Array with Seq_One_Findp. 334
Using the TypeName Member Functionp. 335
Searching a Sorted Array with Bin_Searchp. 336
Determining the Number of Array Elementsp. 337
Looping Through an Array of Character Stringsp. 338
Setting Optional Ranges for Arraysp. 339
Understanding Structuresp. 340
A Structure is a Template for Variable Declarationsp. 341
A Structure Tag is the Structure's Namep. 342
Declaring a Structure Variablep. 343
Using the Public--Private Keywords With Structuresp. 344
Understanding Structure Membersp. 345
Visualizing a Structurep. 346
Putting a Structure to Usep. 347
Passing a Structure to a Functionp. 348
Changing a Structure Within a Functionp. 349
Structure Definitions Have Scopep. 350
Initializing a Structurep. 351
Performing Structure Input/Outputp. 352
Using a Nested Structurep. 353
Structures That Contain Arraysp. 354
Creating an Array of Structuresp. 355
Using Files, Directories, and Disks--The Easy Way and the Hard Wayp. 356
Using the DriveListBox Controlp. 357
Using the DriveListBox Control to Change the Drivep. 358
The DirectoryListBox Controlp. 359
Changing the Default Directoryp. 360
Using the FileListBox Controlp. 361
Showing Only Some Files in the Listp. 362
Understanding the Common Dialog Controlp. 363
Using Patterns with the CommonDialog Controlp. 364
Setting the Default Path for the CommonDialog Controlp. 365
Returning the Selected File and Pathp. 366
Saving a Text Filep. 367
Canceling the Open or Save As Processes Using Cancelp. 368
Understanding the Windows APIp. 369
Using the API Viewerp. 370
Using the GetCurrentDirectory API Functionp. 371
Writing a Wrapper Functionp. 372
Using the SetCurrentDirectory API Functionp. 373
Using the GetDiskFreeSpace API Functionp. 374
Using the GetVolumeInformation API Functionp. 375
Using the GetDriveType API Functionp. 376
Trapping for a Drive Not Readyp. 377
Renaming Files From Within Your Programsp. 378
Deleting Files from Within a Programp. 379
Deleting Directories from Within a Programp. 380
Setting a File's Access Modep. 381
Determining a File's Sizep. 382
Using the Open Statementp. 383
Using the Close Statementp. 384
Using Sequential File Access to Read From a Filep. 385
Using the EOF Function When Reading Filesp. 386
Using Sequential File Access to Write To a Filep. 387
Using LOF and Loc to Read Binary Filesp. 388
Using Input and Input # to Read From Filesp. 389
Using Write # To Output to a Sequential Filep. 390
Revisiting Structures and File I/Op. 391
Using Put to Write Data to a Random-Access Filep. 392
Using Get to Retrieve Records from a Random-Access Filep. 393
Using the Seek Statement to Move Through Random-Access Filesp. 394
Creating Temporary Filesp. 395
Getting the Windows Pathp. 396
Getting the System Pathp. 397
Minimize File I/O Operationsp. 398
Using the ChDrive and ChDir Statementsp. 399
Creating a Directoryp. 400
Removing a Directoryp. 401
Removing a Directory Tree Using Recursionp. 402
Parsing a PathNamep. 403
Obtaining a File's Date and Time Stampp. 404
Using Dir to Locate Directories and Filesp. 405
Sorting the Returned Values for Dir Into Files and Directoriesp. 406
Using Dir to Locate Filesp. 407
Copying Files from Within Your Programsp. 408
Moving Files From Within Your Programsp. 409
Searching for Filesp. 410
Using the FindFirstFile Functionp. 411
Finding the Remaining Occurrences with FindNextFilep. 412
Searching the Entire Directory Treep. 413
Creating a User Interface With The Files Returned from a Find Operationp. 414
Using the Findxxx Functions to Locate Directoriesp. 415
Using the Find Functions to Recursively List All Directories in a Treep. 416
Removing a Directory Tree Revisited: Using Recursionp. 417
Obtaining the Current System Datep. 418
Obtaining the Current System Timep. 419
Returning a Date Value Representing the Current Date and Timep. 420
Delaying a Specific Number of Millisecondsp. 421
Delaying an Approximate Number of Millisecondsp. 422
Limitations of Sleep and DoEventsp. 423
Determining Your Program's Processing Timep. 424
Comparing Two Times Revisitedp. 425
Using DoEvents to Delay A Specific Number of Secondsp. 426
Converting a Date to a String and Backp. 427
Verifying a String as a Datep. 428
Setting the System Date and Timep. 429
Setting the Date and Time Using Integer Valuesp. 430
Adding Time to a Datep. 431
Segmenting a Date into its Component Partsp. 432
Understanding the Single Document Interfacep. 433
Understanding SDI Formsp. 434
Understanding the Show Methodp. 435
Understanding the Load Statementp. 436
Understanding Unload and Hidep. 437
Basics of Good Form Designp. 438
Naming Formsp. 439
Varying Form Layoutsp. 440
Understanding Control Arraysp. 441
Creating Control Arraysp. 442
Naming Control Arraysp. 443
Understanding Form Arraysp. 444
Understanding the Creation of an MDI Interfacep. 445
Creating a Form Arrayp. 446
Using a Boolean Array to Manage the Form Arrayp. 447
Using a Control Array to Create Objects at Run Timep. 448
Removing Objects from a Control Array at Run Timep. 449
Understanding Menusp. 450
Using the Menu Editorp. 451
Creating a Menup. 452
Adding Functionality to the Menup. 453
Using the Enabled Property with Menusp. 454
Using the Checked Property with Menusp. 455
Creating a Windowlistp. 456
Understanding Accelerator Keysp. 457
Using the Tile and Cascade Commandsp. 458
Understanding Menu Arraysp. 459
Creating a Menu Arrayp. 460
Understanding the Difference Between Menus and Pop-up Menusp. 461
Creating a Pop-up Menup. 462
Adding Code to the Pop-Up Menu Optionsp. 463
Implementing the Pop-up Menup. 464
Creating Intelligent Contextual Menusp. 465
Using the Boldcommand Propertyp. 466
Menus on Child Forms Transpose to the Parent Formp. 467
Using Negotiation with Menusp. 468
Displaying Multiple Modal Formsp. 469
Displaying Modeless Forms After Displaying a Modal Formp. 470
Scope of Procedures Within a Formp. 471
Exposing Values to Outside Entitiesp. 472
Using Public Events With Outside Entitiesp. 473
Understanding the ActiveForm Propertyp. 474
Understanding the Load, Initialize and Activate Form Eventsp. 475
Understanding the Resize Eventp. 476
Understanding the QueryUnload and the Unload Eventsp. 477
Understanding the Deactivate and LostFocus Form Eventsp. 478
Understanding the Terminate Eventp. 479
The Refresh Methodp. 480
Controlling the Height and Width of Formsp. 481
Understanding Containersp. 482
Understanding Framesp. 483
Using Containers to Manage the Formp. 484
Using the GetSystemMetrics API Functionp. 485
Using GetSystemMetrics Together With Resizep. 486
Using the Hide Method with SDI Formsp. 487
Understanding the MouseMove Eventp. 488
The MousePointer Propertyp. 489
Using the MouseIcon Propertyp. 490
Using the Icon Property with Formsp. 491
Using the Toolbar Controlp. 492
Understanding Objects and Collectionsp. 493
Using the Buttons Collection and the Button Objectp. 494
Creating a Toolbar With Text Buttonsp. 495
Understanding the ImageList Controlp. 496
Using the ImageList and Toolbar Controls Togetherp. 497
Using Toolbars in MDI Programsp. 498
Toolbars on Both Parent and Child Formsp. 499
Placing Toolbars only on the Parent Formp. 500
Toolbars and ActiveFormp. 501
Using Toolbars and Menus in Conjuctionp. 502
Maintaining a Constant Image Sizep. 503
Designing Custom Iconsp. 504
Distributing Icons With Programsp. 505
Understanding the StatusBar Controlp. 506
Understanding the Panel Object, Panels Collectionp. 507
Creating a StatusBar Controlp. 508
Writing an UpdateStatusBar Subroutinep. 509
Sectioning the Status Barp. 510
Using MouseMove With the Status Barp. 511
Using Multiple StatusBarsp. 512
Revisiting Public versus Private Functionsp. 513
Passing Object Variables to Proceduresp. 514
Passing Control Arrays Into Proceduresp. 515
Introducing Public Controlsp. 516
Sensing Keypresses with the KeyPress Eventp. 517
Using KeyPress with a TextBox to Receive a User Passwordp. 518
Understanding the KeyDown and KeyUp Eventsp. 519
Setting a Form's WindowState Propertyp. 520
Controlling the Caption of a Formp. 521
Creating an IsDirty Propertyp. 522
Reviewing Formsp. 523
Advanced Controlsp. 524
Revisiting the CommonDialog Controlp. 525
Using the CommonDialog Control to Printp. 526
Printing Text to the Default Printerp. 527
Understanding the Printer object, Printers collectionp. 528
Using the For Each-Next Constructionp. 529
Understanding the EndDoc Methodp. 530
Using the CommonDialog Control to Set Fontsp. 531
Setting Fonts in a Rich TextBox with the CommonDialogp. 532
Using the Change Event with Edit Fieldsp. 533
Understanding Libraries and Reusable Object Codep. 534
Understanding ActiveX DLLsp. 535
Creating and Using Project Groupsp. 536
Displaying Predefined Error Messagesp. 537
Understanding Portabilityp. 538
Branching and Returning Within a Procedurep. 539
Using Structure Variables Instead of Constantsp. 540
Visual Basic's Predefined Constantsp. 541
Using Enumerated Typesp. 542
Putting an Enumerated Type to Usep. 543
Understanding an Enumerated Valuep. 544
Assigning a Specific Value to an Enumerated Typep. 545
Understanding Child Processesp. 546
Using the Shell Functionp. 547
Using a Temporary File to Pass Data to the Child Processp. 548
Using AppActivate to Activate the Child Processp. 549
Using Shell to Run Programs Sequentiallyp. 550
Using Break for Debuggingp. 551
Adding Watchesp. 552
The Watch Windowp. 553
Stepping Into Your Program Codep. 554
Stepping Over a Procedure's Codep. 555
Stepping Outp. 556
Restarting the Programp. 557
Setting Breakpoints Within the Programp. 558
Understanding Labelsp. 559
Using Labels for Error-Trapping Routinesp. 560
Using Labels for GoTo Loopsp. 561
Understanding Critical Errorsp. 562
Using the Timer Event to Autosave Informationp. 563
Understanding the Timer Controlp. 564
Understanding Invariant Codep. 565
Understanding Code Compactionp. 566
Understanding Loop Compactionp. 567
Using Common Subexpression Eliminationp. 568
Grasping Visual Basic's Basic Typesp. 569
Understanding Derived Typesp. 570
Rules for Using Initializersp. 571
Contrasting Declarations and Definitionsp. 572
Declaring Variables Where You Need Themp. 573
Revisiting the Optional Keywordp. 574
Revisiting the ParamArray Keywordp. 575
Using Default Values with Optional Parametersp. 576
Using Default Typesp. 577
Understanding Lazy (or Short-Circuit) Evaluationp. 578
Creating an Instance of an Object with the New Operatorp. 579
Using Functions as Members Within Structuresp. 580
Different Structures with the Same Member Namesp. 581
Understanding Objectsp. 582
Understanding Object-Oriented Programmingp. 583
Understanding Why Visual Basic is not Truly Object-Orientedp. 584
Understanding Visual Basic Classesp. 585
Conceptualizing Classesp. 586
Creating Classes Using the Class Builder Utilityp. 587
Understanding the Public Labelp. 588
Understanding Information Hidingp. 589
Using the Private Keyword Within a Classp. 590
Using Public and Private Datap. 591
Public Methods Are Often Called Interface Functionsp. 592
Defining Class Functionsp. 593
Using the Property Let and Property Get Methodsp. 594
Understanding Object Instancesp. 595
Creating Object Instancesp. 596
Understanding Class Scopep. 597
Creating an Array of Class Variablesp. 598
Using With-End Withp. 599
Understanding Encapsulationp. 600
Revisiting Librariesp. 601
Ordering Public and Private Membersp. 602
Understanding Default Scope with Class Modulesp. 603
Understanding the Static Storep. 604
Understanding ActiveXp. 605
Understanding the Difference Between ActiveX and OLE 2.0p. 606
Using the WithEvents Property in a Dimension Statementp. 607
Using the ActiveX Controls Provided with Visual Basicp. 608
Using the Change Eventp. 609
Understanding the ComboBox Controlp. 610
Using the Change and Click Events with the ComboBoxp. 611
Using ComboBoxes to Change Information on a Formp. 612
Deciding Between Combo and ListBoxesp. 613
Understanding the MaskEdBox Controlp. 614
Using the MaskEdBox Control to Validate Datap. 615
Revisiting Reusable Objectsp. 616
Placing Proceduresp. 617
Using a Control Event to Trigger Other Eventsp. 618
Using LostFocus Together with ListIndex to Start Dependent Formsp. 619
Understanding Forms as Classesp. 620
Understanding an Entirely Dialog Box-Based Applicationp. 621
Changing the Startup Location of a Programp. 622
Understanding Initialization Routinesp. 623
Placing Global Variables and Procedures in Multiple Locationsp. 624
Using Functions to Return a User-Defined Class or Structurep. 625
Understanding the Picture Box Controlp. 626
Using a PictureBox Controlp. 627
Understanding the Image Controlp. 628
Displaying Pictures on a Formp. 629
Using the Shape Controlp. 630
Using the Line Controlp. 631
Using Checkboxes to Obtain Boolean Valuesp. 632
Using Multiple Groups of Option Buttons on a Single Formp. 633
Using Horizontal and Vertical Scroll Barsp. 634
Understanding the Timer Controlp. 635
Understanding Custom Controlsp. 636
Using Custom Controlsp. 637
Revisiting Rich TextBoxesp. 638
Creating the Basics of the Interfacep. 639
Adding Functionality to the MDN Programp. 640
Adding the Find Dialog Boxp. 641
Improving the Multiple-Document Notepad Applicationp. 642
Revisiting the Query_Unload Eventp. 643
Understanding the Relationship between the Rich TextBox and the CommonDialogp. 644
Understanding the Progress Barp. 645
Using the Progress Bar Controlp. 646
Using the Hourglass Mouse Pointerp. 647
Using the Other MousePointer Propertiesp. 648
Using Global Variables to Protect Against Interruptionsp. 649
Introducing Databasesp. 650
Understanding Database Accessp. 651
Fundamental Principles of Database Designp. 652
Understanding Relational Databasesp. 653
Understanding Normalizationp. 654
Minimizing Your Database's Storage Requirementsp. 655
Protecting Your Databasep. 656
Understanding the System.MDW Filep. 657
Introducing SQLp. 658
Understanding how Access SQL is Different from ANSI SQLp. 659
Getting Started with the Visual Data Managerp. 660
Understanding DAO and ODBCp. 661
Using the DAO Objectsp. 662
Using the SQL Create Table Statementp. 663
Understanding and Formatting SQL Create Table Statementsp. 664
Understanding the Execute Methodp. 665
Creating Indexes Using Constraintp. 666
Using the SQL Create Index Statementp. 667
Determining Which Fields to Indexp. 668
Understanding Primary Keysp. 669
Understanding the Workspace Objectp. 670
Using the OpenDatabase Methodp. 671
Creating a New Databasep. 672
Understanding the Database Objectp. 673
Understanding the Recordset Objectp. 674
Using the OpenRecordset Methodp. 675
Understanding the SQL Select Statementp. 676
Retrieving Recordsetsp. 677
Understanding the Order By Clausep. 678
Understanding the Where Clausep. 679
Understanding Inner Joinsp. 680
Understanding Left and Right Joinsp. 681
Understanding Set with Databasesp. 682
Understanding the QueryDef Objectp. 683
Using the RecordCount Propertyp. 684
Understanding the Move Methodsp. 685
Using the BOF and EOF Propertiesp. 686
Determining if a Recordset is Emptyp. 687
Using the Find Methodsp. 688
Using the Seek Methodp. 689
Understanding Bookmarksp. 690
Using Bookmarksp. 691
Using Scratch Recordsetsp. 692
Understanding Recordset Creation Errorsp. 693
Understanding Groupsp. 694
Understanding Usersp. 695
Understanding Permissionsp. 696
Understanding DAO Documents and Containersp. 697
Adding New Recordsp. 698
Using the Update and Edit Methodsp. 699
Using the Requery Methodp. 700
Validating Datap. 701
Understanding Transaction Processingp. 702
Using Begin Trans and CommitTransp. 703
Using the Rollback Methodp. 704
Understanding the Data Controlp. 705
Using the Data Control with Stored Queriesp. 706
Handling BOF and EOF with the Data Controlp. 707
Understanding the RecordSource Propertyp. 708
Understanding Data-Bound Controlsp. 709
Using Multiple Data Controlsp. 710
Understanding the Data-Bound Grid Controlp. 711
Using the Data-Bound Grid Controlp. 712
Sizing the Width of the Data-Bound Gridp. 713
Placing a RecordCount Caption in the Data Controlp. 714
Changing the RecordCount Caption Using the Grid Controlp. 715
Understanding the Data-Bound ListBox Controlp. 716
Using the Data-Bound List Controlp. 717
Linking the DBList Control to Another Controlp. 718
Understanding the Data-Bound ComboBox Controlp. 719
Using the Data-Bound ComboBox Controlp. 720
Understanding the Clone Methodp. 721
Using the Clone Methodp. 722
Using the DataChanged Propertyp. 723
Understanding SQL-Transact Statementsp. 724
Understanding Update Queriesp. 725
Using an Update Queryp. 726
Understanding Delete Queriesp. 727
Understanding Union Queriesp. 728
Understanding the Group By Statementp. 729
Using the Group By Statementp. 730
Understanding the SQL Aggregate Functionsp. 731
Using the Sum Statementp. 732
Understanding the Having Statementp. 733
Using Variables in Queriesp. 734
Creating New Queries Using a Query Resultp. 735
Using On Error-Resume with SQL Queriesp. 736
Preventing Errors By Checking Valuesp. 737
Creating Backups of Databasesp. 738
Introducing Client-Server Databasesp. 739
Understanding Remote Data Objectsp. 740
Understanding the RemoteData Controlp. 741
Creating Recordsets with the RemoteData Controlp. 742
Understanding the RemoteData Constantsp. 743
Understanding the rdoEnvironment Objectp. 744
Establishing a Remote Data Connectionp. 745
Maintaining Information About an Open Connectionp. 746
Understanding the Field Objectp. 747
Determining When to Use Ordinal Numbers with Collectionsp. 748
Using Field Names to Manage Databasesp. 749
Understanding Record Lockingp. 750
Saving Records from Unbound Controlsp. 751
Updating Records from Unbound Controlsp. 752
Revisiting the Importance of Databasesp. 753
Understanding the TreeView Controlp. 754
Understanding the Node Objectp. 755
Using the TreeView Controlp. 756
Understanding the Add Method of the Nodes Collectionp. 757
Adding Images to the TreeView Controlp. 758
Using the ProgressBar while Populating the TreeView Controlp. 759
Filling the TreeView Control From a Recordsetp. 760
Understanding Visual Basic and the Internetp. 761
Understanding the MSComm Controlp. 762
Understanding the CommEvent Propertyp. 763
Using the MSComm Controlp. 764
Understanding the OnComm Eventp. 765
Using the OnComm Eventp. 766
Understanding the RThreshold and SThreshold Propertiesp. 767
Transmitting Data with the MSComm Controlp. 768
Receiving Data Using the MSComm Controlp. 769
Creating a Simple Terminal Programp. 770
Creating Automated Transmission Eventsp. 771
Understanding the Winsock Controlp. 772
Using the Winsock Controlp. 773
Understanding the GetData Methodp. 774
Understanding the SendComplete and SendProgress Eventsp. 775
Returning a Handle from a Winsock Controp. 776
Using the Winsock Control on the Server Machinep. 777
Returning the Current State of the Winsock Controlp. 778
Understanding the Internet Transfer Controlp. 779
Understanding the Execute Methodp. 780
Using Execute with HTTP Commandsp. 781
Using Execute with FTP Commandsp. 782
Ensuring your Name and Password are Maintainedp. 783
Connecting to the Internetp. 784
Navigating the FTP Serverp. 785
Using Get to Retrieve a File from an FTP Serverp. 786
Writing to the FTP Serverp. 787
Writing an Automatic FTP Upload and Retrieve Programp. 788
Writing an FTP Browserp. 789
Understanding the WebBrowser Controlp. 790
Using the WebBrowser Controlp. 791
Understanding the Navigate Methodp. 792
Understanding the NavigateComplete Eventp. 793
Using the LocationURL Propertyp. 794
Using the ProgressChange Eventp. 795
Using the LocationName Propertyp. 796
Understanding the DownloadBegin and DownloadComplete Eventsp. 797
Stopping a Page Downloadp. 798
Accessing FTP From Within the WebBrowser Controlp. 799
Creating Multiple Web Browsersp. 800
Setting a Home Pagep. 801
Moving Back and Forwardp. 802
Writing the Visual Basic Internet Browserp. 803
Revisiting ActiveXp. 804
Understanding the Different Types of ActiveXp. 805
Determining Whether to use an ActiveX Control, EXE, or DLLp. 806
Understanding the UserControl Objectp. 807
Using Visual Basic to Create Controlsp. 808
Understanding Visual Basic Control Creation Editionp. 809
Understanding ActiveX Securityp. 810
Signing ActiveX Controlsp. 811
CABbing ActiveX Controlsp. 812
CABbing a Sample ActiveX Controlp. 813
Using the Wizard to Create an ActiveX Controlp. 814
Understanding the Create Custom Interface Members Dialog Boxp. 815
Mapping Functionalityp. 816
Setting Attributesp. 817
Completing the Wizardp. 818
Beginning to Create the ActiveX Controlp. 819
Making the Control Functionalp. 820
Testing the Controlp. 821
Understanding ActiveX Control Eventsp. 822
Understanding an ActiveX Control's Lifetimep. 823
Responding to non-LifeTime Eventsp. 824
Understanding the RaiseEvent Statementp. 825
Using the Event Statementp. 826
Adding Functionality to the Controlp. 827
Executing the ColorfulCmdButton Control's Containerp. 828
Understanding the Property Page Wizardp. 829
Using the Property Page Wizardp. 830
Understanding ActiveX Documentsp. 831
Creating an ActiveX Documentp. 832
Targeting a Container for your ActiveX Documentp. 833
Discovering the Target Application's Object Modelp. 834
Understanding Variations in the Object Modelp. 835
Understanding the UserDocument Objectp. 836
Using the UserDocument Objectp. 837
Testing the ActiveX Documentp. 838
Debugging the FirstACXDoc ActiveX Documentp. 839
Adding a Second ActiveX Document to the Projectp. 840
Running the Two Document Projectp. 841
Understanding ActiveX DLL Filesp. 842
Creating the Class for your ActiveX DLL Filep. 843
Creating the Properties and Methods for the Happy Classp. 844
Initializing the Classp. 845
Creating the MyTest Projectp. 846
Instantiating the MyTest Classp. 847
Executing the MyTest Projectp. 848
Understanding Object Lifetimesp. 849
Adding the SelfAbsorbed Property to the MyTest Classp. 850
Understanding Circular Referencesp. 851
Understanding ActiveX Component Naming Guidelinesp. 852
Understanding Well-Behaved Componentsp. 853
Understanding VB Scriptp. 854
Understanding the Benefits of VB Scriptp. 855
Using VBScript Within HTMLp. 856
Responding to Events in VBScriptp. 857
Executing the Hello.HTML Filep. 858
Commenting VBScriptp. 859
Implementing Mathematical Functions in VBScriptp. 860
Implementing Events and Operationsp. 861
Using Option Explicit with VBScriptp. 862
Using Dim in VBScriptp. 863
Using VBScript with ActiveX Controlsp. 864
Accessing ActiveX Controls From VBScriptp. 865
Using the Label and Timer Controls within an HTML Pagep. 866
Referencing ActiveX Controlsp. 867
Understanding the PARAM NAME Tagp. 868
Registering ActiveX Controlsp. 869
Using the Registry Editor to Discover Class Idsp. 870
Using the WebBrowser Control within an HTML Filep. 871
Active Sever Pagesp. 872
Responses and Request in ASPp. 873
Making Use of Querystring Parametersp. 874
A formating Shortcutp. 875
Back Where You Came Fromp. 876
Understanding .ini Filesp. 877
Using the WritePrivateProfileString API With Filesp. 878
Using the GetPrivateProfileString API with .ini Filesp. 879
Using the GetPrivateProfileInt API with .ini Filesp. 880
Using .ini Files with Distributed Programsp. 881
Understanding the Limitations of .ini Filesp. 882
Understanding the System Registryp. 883
Understanding the SaveSetting Functionp. 884
Understanding the GetSetting Member Functionp. 885
Using the SaveSetting and GetSetting Statementsp. 886
Saving Form Sizes and Positions in the Registryp. 887
Passing Variables Between Programs within the Registryp. 888
Using the DeleteSetting Functionp. 889
Using the GetAllSettings Functionp. 890
Using API Functions with the Registryp. 891
Understanding the RegOpenKeyEx API Functionp. 892
Understanding the RegQuery ValueEx Functionp. 893
Understanding the RegCloseKey Functionp. 894
Using the API Functions When Opening Formsp. 895
Understanding the RegCreateKeyEx Functionp. 896
Understanding the RegSetValueEx Functionp. 897
Using RegSetValueEx and RegCreate ValueExp. 898
Capturing Registry Errorsp. 899
Deleting Keys and Values Using API Functionsp. 900
Considering Registry Accessp. 901
Understanding Conditional Compilationp. 902
Understanding the #Const Statementp. 903
Understanding #If-Then-#Elsep. 904
Using Conditional Compilationp. 905
Understanding the GetWindowsDirectory API Functionp. 906
Understanding the GetSystemDirectory API Functionp. 907
Using the GetWindow Functionp. 908
Finding a Window's Namep. 909
Exporting Your Applicationp. 910
Understanding the Visual Basic Setup Wizardp. 911
Selecting a Project File to Distributep. 912
Selecting the Distribution Mediap. 913
Ensuring that all Files are in the Distribution Listp. 914
Saving Installation Templatesp. 915
Generating Your Distribution Mediap. 916
Installing the Program at the User's Computerp. 917
Creating an Internet Distributionp. 918
Reconsidering the Application Wizardp. 919
Using Application Wizard to Generate Standard Formsp. 920
Understanding the Splash Screenp. 921
Understanding the About Boxp. 922
Adding Database Forms Using the Wizardp. 923
Understanding Crystal Reportsp. 924
Using Crystal Reportsp. 925
Selecting a Data Source for Your Reportp. 926
Adding Fields to Your Reportp. 927
Grouping Records within Your Reportp. 928
Totaling and Counting Grouped Fieldsp. 929
Selecting Records and Styling the Reportp. 930
Modifying the Reportp. 931
Moving, Resizing, Formatting and Deleting fieldsp. 932
Changing the Sort Sequence of Report Datap. 933
Correcting the Sort and Group Orderp. 934
Creating Custom Groupsp. 935
Working with Summarized and Totaled Fieldsp. 936
Inserting Subtotalsp. 937
Inserting a Grand Totalp. 938
Inserting a Summaryp. 939
Selecting Recordsp. 940
Returning the Top N Records in a Groupp. 941
Creating Formulasp. 942
Adding a Graph/Chart to Your Reportp. 943
Inserting OLE or ActiveX Objects into Your Reportp. 944
Adding or Changing a Report Titlep. 945
Understanding the Crystal Report Enginep. 946
Understanding the Crystal ActiveX Controlp. 947
Using the Crystal ActiveX Controlp. 948
Understanding the Icons on the Crystal Windowp. 949
Limitations of the Crystal Reports Controlp. 950
Extending Visual Basicp. 951
Revisiting the Object Modelp. 952
Understanding Add-Insp. 953
Creating an Add-Inp. 954
Accessing the Extensibility Modelp. 955
Creating the Project Componentsp. 956
Understanding the IDTExtensibility Interfacep. 957
Understanding the OnConnection Functionp. 958
Dissecting the OnConnection Codep. 959
Understanding the AddToAddInCommandBar Functionp. 960
Customizing the Connect Modulep. 961
Adding the Final Componentp. 962
Completing the Add-In's Designp. 963
Adding the Add-In to the .ini Filep. 964
Loading Your Add-Inp. 965
Troubleshooting the Add-Inp. 966
Understanding ActiveX Exep. 967
Differentiating Between In-Process and Out-of-Process Componentsp. 968
Understanding Threadsp. 969
Understanding Asynchronous Processingp. 970
Understanding Asynchronous Notification Using Eventsp. 971
Understanding Asynchronous Notification Using Call-Back Methodsp. 972
Using Call-Backs With Multiple Clientsp. 973
Deciding Between Events or Call-Backs for Notificationsp. 974
Understanding Type Librariesp. 975
Understanding Default Interfacesp. 976
Revisiting GUIDsp. 977
Understanding Version Compatibilityp. 978
Creating an ActiveX EXEp. 979
Understanding Modality with Out-Of-Process Componentsp. 980
Beginning the Creation of the Test Projectp. 981
Adding Code to the Test Projectp. 982
Viewing TestForm Modallyp. 983
Viewing TestForm Modelesslyp. 984
Using Asynchronous Notificationsp. 985
Completing the Code For the Event Notificationp. 986
Writing the Client Programp. 987
Considering How to Handle Multiple Clientsp. 988
Using the Connector Objectp. 989
Recognizing the Bug in Connectorp. 990
Using Asynchronous Call-Back Methodsp. 991
Creating the Lunch TimeMonitor Executablep. 992
Distributing the ActiveX EXEp. 993
Understanding Single Threadsp. 994
Ordering Your Development of ActiveX Componentsp. 995
Revisiting Multithreadingp. 996
Understanding Apartment-Model Threadingp. 997
Understanding Reentrancyp. 998
Understanding Binary Compatibilityp. 999
Avoiding Version Treesp. 1000
Avoiding Version Compatibility Messagesp. 1001