Cover image for Visual Basic 6 from scratch
Visual Basic 6 from scratch
Donald, Robert P.
Personal Author:
Publication Information:
Indianapolis, Ind. : Que, [1999]

Physical Description:
xiii, 487 pages : illustrations ; 23 cm + 1 computer optical disc (4 3/4 in.).
General Note:
CD-ROM includes: Visual Basic 6.0 working model edition.

Includes index.
Title Subject:
Added Author:
Format :


Call Number
Material Type
Home Location
Item Holds
QA76.73.B3 D66 1999 TEXT Adult Non-Fiction Central Closed Stacks

On Order



Visual Basic From Scratch is designed to walk novice programmers through the analysis, design and implementation of a functioning application using Visual Basic. You will learn all the critical programming concepts and techniques associated with the language in the context of creating a functioning online database application. Learn how to track inventory, customers, and sales through the various tools and methods used to create the online database. Each chapter builds on the previous with a casual tone, in-depth examples, and detailed steps to ultimately create a working online database.

Author Notes

Bob Donald has more than 11 years programming experience working with various languages, such as Visual Basic, Visual C++, and Java He has developed several client/server and multitiered systems involving a number of different technologies--including MFC, ODBC, COM, ATL, Corba, JavaBeans. SOL, and Pen-based computers.
Gabriel Oancea has more than 14 years progressive experience in object-oriented analysis and design, systems architecture, and developing client/server and multilayered systems.

Table of Contents

Introductionp. 1
Part I Lay Out the Foundationsp. 9
Chapter 1 Introduction to Visual Basicp. 11
Introductionp. 11
A Tour of the Visual Basic Environmentp. 12
The Title Barp. 14
The Menu Bar and Menusp. 14
The Toolbarp. 17
The Project Explorer Windowp. 17
The Properties Windowp. 18
The Forms Windowp. 18
The Form Layout Windowp. 19
The Toolboxp. 19
The Code Windowp. 19
Saving Your Workp. 21
Saving to a New Directoryp. 21
Types of Visual Basic Projectsp. 23
Types of Visual Basic Filesp. 23
Customizing Your Environmentp. 24
Next Stepsp. 25
Chapter 2 Brief Language Overviewp. 27
Variablesp. 28
Datatypesp. 29
Can I Define My Own Datatypes?p. 30
Arraysp. 31
Constantsp. 33
Operatorsp. 34
Formsp. 35
Subroutinesp. 35
Functionsp. 35
Modulesp. 36
Classesp. 37
Naming Conventionsp. 37
Next Stepsp. 38
Chapter 3 Starting the Projectp. 39
Introductionp. 39
Defining the Project Used Throughout the Bookp. 39
Project Requirementsp. 40
Administrative Servicesp. 41
Customer Servicesp. 42
Creating a Visual Basic Project from Scratchp. 43
Creating the Login Formp. 45
Adding a Label to a Formp. 47
Setting Tab Stops on a Formp. 50
Setting Shortcut Keysp. 51
Running the Login Formp. 51
Next Stepsp. 52
Chapter 4 Validating the User Through a Login Formp. 53
Introductionp. 53
Adding Procedures and Functionsp. 53
What Are Modules?p. 54
Contents of a Standard Modulep. 55
Adding a Standard Module and Creating the CheckLogin Functionp. 57
Adding Code to the Formp. 61
A Closer Look at the If ... Then Statementp. 64
A Closer Look at Using MsgBoxp. 65
Next Stepsp. 69
Chapter 5 Enhancing the Login Dialogp. 71
Introductionp. 71
Set Command Button Properties on the Login Formp. 71
Command Button Propertiesp. 73
Add Code to the Cancel Buttonp. 76
Events and Event-Driven Programmingp. 77
Event Handlersp. 78
Command Button Eventsp. 78
Next Stepsp. 81
Chapter 6 Creating a First Executablep. 83
Introductionp. 83
Interpreted Languagesp. 83
Making a Visual Basic Executablep. 85
Next Stepsp. 90
Part II Develop the User Interface: Adding UI Elements and Base Functionalityp. 91
Chapter 7 Extending the Project with a New Formp. 93
Add a Form to the Projectp. 93
Add a Menu Bar to the Main Formp. 95
Creating Child Menusp. 97
Creating a Control Array to Store Menu Itemsp. 100
Implementing the Menu Click Eventp. 101
Adding a New MDI Child Formp. 102
Creating and Working with Objectsp. 103
Adding Custom Properties and Methods to the Formp. 105
Implementing Property Proceduresp. 106
Next Stepsp. 110
Chapter 8 Adding Controls to the Main Formp. 111
Introductionp. 111
Adding the Windows Common Controls Referencep. 112
Adding a StatusBar Control to the Main Formp. 113
Properties of the StatusBar Controlp. 114
Adding Panels to the StatusBar Controlp. 115
Extending StatusBar Functionality Using Codep. 118
Adding an ImageList Control to the Main Formp. 119
Properties of the Image Controlp. 119
Adding Images to the Controlp. 122
Add a ToolBar Control to the Main Formp. 123
Properties of the ToolBar Controlp. 123
Adding ToolBar Buttonsp. 125
Adding Drop-Down Buttonsp. 126
Adding Code for the ToolBar Controlp. 129
Implementing the But tonMenuClick Eventp. 130
Next Stepsp. 132
Chapter 9 Implementing a Data-Entry Formp. 133
Adding Controls to the Customer Formp. 133
Changing the Font Property of a Controlp. 135
Adding a MaskedEdit Controlp. 136
Other Properties for the Built-In Controlsp. 138
Handling Events from the Controls on the Customer Formp. 141
GotFocus and LostFocusp. 141
The Click Eventp. 142
Next Stepsp. 143
Chapter 10 More About Forms and Controls: Properties, Methods, and Eventsp. 145
Adding a New Form for Productsp. 145
Adding Controls to the Formp. 146
Adding a ComboBox Controlp. 146
Adding a Common Dialog Box Controlp. 148
Adding Code for the Product Formp. 148
Opening a File Using the Common Dialog Controlp. 149
Handling Errors in Codep. 152
Handling the Save and Cancel Click Eventsp. 153
Form Interaction--The Activate and Deactivate Eventsp. 155
Adding a New Form to Display an Image--The Image Controlp. 156
Adding Code to Show the Formp. 159
Adding a New Form to View a Document--The Rich TextBox Controlp. 160
Adding Code to Handle Form Resizingp. 160
Next Stepsp. 162
Chapter 11 Creating an Explorer-Style Form Using TreeView and ListView Controlsp. 165
Adding a New Customer Orders View Formp. 165
Adding the TreeView Controlp. 166
Properties of the TreeView Controlp. 168
Adding the ListView Controlp. 169
General Properties of the ListView Controlp. 170
Other Properties of the ListView Controlp. 172
Adding the ImageList Controlsp. 172
Adding a Custom Resources File to the Projectp. 173
Adding Code to Resize the Splitter Formp. 174
Resizing the Controlsp. 175
Changing the Mouse Shape Depending on the Mouse Positionp. 176
Executing the Resize--Handling Mouse Eventsp. 178
Adding a Right-Click Pop-Up Menup. 182
Activating the Pop-Up Menu from Codep. 182
Next Stepsp. 185
Chapter 12 Designing a Master-Detail Style Formp. 187
Adding the Order Entry Formp. 187
Adding a Grid to the Formp. 189
FlexGrid Propertiesp. 189
Completing the Order Formp. 191
Adding the Order Item Dialog Boxp. 193
Adding Code to the Order and Order Item Formsp. 196
Next Stepsp. 199
Part III Add Functionality: Creating Persistent Objectsp. 201
Chapter 13 Elementary Object-Oriented Conceptsp. 203
Object-Oriented Conceptsp. 204
Classes, Objects, and Propertiesp. 204
Methodsp. 206
Encapsulationp. 207
Inheritancep. 207
Polymorphismp. 208
Classes in Visual Basicp. 208
Propertiesp. 209
Property Proceduresp. 210
Methodsp. 211
Class Initialize and Class Terminatep. 211
Adding a Customer Class to the Projectp. 212
Property Get Procedurep. 214
Property Let Procedurep. 215
Property Set Procedurep. 216
Adding the Product Class and the Order Class to the Projectp. 218
Using Enumerations for Order Status Propertiesp. 221
Next Stepsp. 225
Chapter 14 Defining the Interface: Properties and Methodsp. 227
Validating Property Valuesp. 228
Implementing Calculated Property Valuesp. 232
Verifying Required Propertiesp. 233
Expanding the Order Class to Contain a Collection of Order Itemsp. 234
Modeling the Orderp. 234
Creating the OrderItem Classp. 236
Creating the OrderItemColl Classp. 238
Adding Order Items to the Order Classp. 242
Next Stepsp. 245
Chapter 15 Elementary Database Concepts: Persisting the State of Our Objectsp. 247
What Is a Database?p. 247
Database Conceptsp. 249
Tablesp. 249
Columnsp. 250
Rowsp. 250
Primary Keysp. 251
Foreign Keysp. 252
Indexesp. 253
SQL Primerp. 253
Insertp. 253
Updatep. 254
Deletep. 255
Selectp. 255
Setting Up a Data Source Name (DSN)p. 256
Defining the Project Schemap. 259
TCustomersp. 259
TProductsp. 260
TUsersp. 260
TOrdersp. 261
TOrderItemsp. 261
Using ActiveX Data Objects (ADO) for Database Accessp. 262
Opening a Database Connectionp. 263
Inserting Recordsp. 263
Updating Recordsp. 264
Deleting Recordsp. 264
Selecting Recordsp. 264
ADO, OLE DB, ODBC--Help!p. 265
Next Stepsp. 267
Chapter 16 Adding Class Persistencep. 269
Encapsulating the Databasep. 269
Creating the DbSession Classp. 270
Connection.Open in More Detailp. 273
Creating a Global DbSession Objectp. 273
Adding Persistence to the Customer Classp. 273
Saving a Customerp. 274
Finding a Customerp. 277
Deleting a Customerp. 279
Adding Persistence to the Product Classp. 280
Saving a Productp. 280
Finding a Productp. 281
Deleting a Productp. 281
Adding Persistence to the Order, OrderItemColl, and OrderItem Classesp. 282
Helper Methods in the OrderItem Classp. 282
Saving and Deleting the Collection of OrderItem Objectsp. 284
Retrieving the Collection of OrderItem Objectsp. 285
Saving an Orderp. 287
Finding an Orderp. 290
Next Stepsp. 291
Chapter 17 Finalizing the Classes in the Projectp. 293
Add Database Support to Validate the Userp. 293
Adding Class Eventsp. 295
Next Stepsp. 304
Part IV Integrate the Subsystems: Finalizing the Applicationp. 305
Chapter 18 Saving and Retrieving Datap. 307
Adding Persistence to the Customer Formp. 307
Introduction to Three-Tiered Software Topologyp. 308
Modify the Customer Form to Make It Persistentp. 309
Adding Persistence to the Product Formp. 312
Adding Persistence to the Order Item Formp. 314
Retrieving a List of Products from the Databasep. 315
Populating the Products Combo Boxp. 317
Refreshing the Controls on the Formp. 319
Saving Changes and Returning a Flagp. 320
Handling the Form Close User Actionp. 323
Adding Persistence to the Order Formp. 324
Populating the Customer Listp. 324
Integrating with the Persistent Order Objectp. 326
Next Stepsp. 334
Chapter 19 Retrieving and Editing Objects from the Databasep. 335
Adding a Search Form for the Customerp. 335
Designing the Formp. 335
Implementing Code for the Customer Find Formp. 338
Next Stepsp. 346
Chapter 20 Error Handling and Reportingp. 347
Adding a Tabular Data Form for the Customerp. 347
Designing the Formp. 347
Adding Code to the Customer List Formp. 349
Error Handling and Reporting in Detailp. 357
Next Stepsp. 361
Chapter 21 Printingp. 363
Adding a Custom Printer Selection Dialog Boxp. 363
Designing the Formp. 364
Adding Code to the Select Printer Dialog Boxp. 365
Setting Printer Propertiesp. 366
Printing an Orderp. 369
Next Stepsp. 379
Part V Final Touches: Debugging and Testing the Systemp. 381
Chapter 22 Finalizing the Projectp. 383
Finalizing the Customer Orders Formp. 383
Adding an About Formp. 390
Adding Help to the Applicationp. 394
Next Stepsp. 395
Chapter 23 Application and Project Settingsp. 397
Application Settingsp. 397
Project Settingsp. 400
Conditional Compilation and Preprocessor Usagep. 403
Next Stepsp. 405
Chapter 24 Debugging and Testing the Applicationp. 407
Introduction to Debuggingp. 407
Compile-Time Errorsp. 407
Exceptionsp. 408
Runtime Errorsp. 409
Debugging Techniquesp. 409
Monitoring Variable and Expression Values at Runtimep. 410
Changing the Value of Variables While Debuggingp. 415
Changing the Code While Debuggingp. 415
Changing the Next Statement to Be Executedp. 416
Error Handling Considerations When Debuggingp. 417
Using Breakpoints and Stepping Through Codep. 418
Using Conditional Breakpointsp. 419
Testing the Applicationp. 420
Next Stepsp. 421
Chapter 25 Revisiting the Processp. 423
Analysisp. 423
Designp. 424
Implementationp. 425
Graphical Design of the UIp. 425
Adding Objectsp. 426
Integrating the Systemp. 427
Documentation and Testingp. 428
Next Stepsp. 428
Chapter 26 Distributed Components: The Way of the Futurep. 429
Introductionp. 429
Advantages of Distributed Componentsp. 430
Splitting the Projectsp. 433
Project Settingsp. 437
Next Stepsp. 443
Part VI Appendixesp. 445
Appendix A COM, ActiveX, and Automationp. 447
Implementing COM Interfacesp. 448
Microsoft COM-Based Technologiesp. 449
Appendix B Visual Basic Controlsp. 451
Standard Properties, Methods, and Eventsp. 451
Intrinsic VB Controlsp. 453
CheckBoxp. 453
ComboBoxp. 454
CommandButtonp. 454
Datap. 454
DirListBox, DriveListBox, and FileListBoxp. 454
Framep. 455
HScrollBar and VScrollBarp. 455
Imagep. 455
Labelp. 455
Linep. 455
ListBoxp. 456
Menup. 456
OptionButtonp. 456
PictureBoxp. 456
Shapep. 457
TextBoxp. 457
Timerp. 457
Indexp. 459