Paul Sheriff has taught Visual Basic long enough to know what beginning programmers want. This book is designed for programmers that have little or no Visual Basic or Windows programming experience. Students will learn the syntax of the Visual Basic language, event driven programming, and how to put together a complete Visual Basic application. The emphasis in this book is on good coding practices such as industry accepted naming standards, indentation and code reusability. If you are a developer who needs to learn how to put together a Visual Basic application the right way, this book is for you.
Table of Contents
Introduction. Fundamentals of Visual Basic 6. I. INTRODUCTION TO VISUAL BASIC 6. 1. Visual Basic Overview. What Is Visual Basic? A Visual Basic Application. History of Visual Basics. Features of Visual Basic. Code Generation Options. Future of Visual Basic. Versions of Visual Basic. Visual Basic Application Types. Visual Basic Application Components. Microsoft Windows. Computing Terms. Programming Applications for Windows. Summary. Review Questions. 2. Getting Started. Visual Basic Environment. Visual Basic First-time Setup. Creating a New Project. Forms. Properties. Naming the Project. The Project Properties Dialog. Saving the Project. Summary. Review Questions. 3. Controls. Controls. Label Control. Text Box Control. Command Buttons. Frames. Option Buttons. Check Boxes. Picture Control. Image Control. Summary. Review Questions. 4. Lists and Menus. List Box Control. Combo Box Control. Menu System. Naming Controls. Creating an Executable Program. Summary. Review Questions. 5. Events Happen. Code Window. Breakdown of an Event Procedure. Form Events. Label Events. Text Box Events. Command Button Events. Frame Events. Option Button Events. Check Box Events. Picture Control Events. Image Control Events. List Box Events. Combo Box Events. Menu Events. Summary. Review Questions. 6. Variables. What Is a Variable? Data Types. Declaring Variables. Assigning Values to Variables. Scope and Lifetime of a Variable. Examples of Variables. Naming Variables. The Variant Data Type. Summary. Review Questions. Exercises. 7. Arrays, Types, and Constants. Arrays. Miscellaneous Array Topics. Multidimensional Arrays. User-defined Types. Constants. Mathematical and Relational Operators. Summary. Review Questions. Exercises. 8. Conditional Logic and Looping. If...Then. Select Case. Compiler Directives. Looping in VB. For...Next. The For...Next Example. Nested Constructs. Exit For/Exit Do. Exit Sub/Exit Function. With...End With. Summary. Review Questions/Exercises. 9. Procedures and Functions. Procedures. Sub Main() Procedure. Functions. Parameters and Arguments. Call by Value and Call by Reference. Optional Arguments. Named Arguments. Naming Standards. Summary. Review Questions. Exercises. 10. Built-in Visual Basic Functions. Using Built-in Functions. String Functions. Date Functions. Conversion Functions. Functions to Test Data Types. Methods. Summary. Review Questions. 11. Dialog Boxes. Uses of Dialog Boxes. Modal Versus Nonmodal. MsgBox. InputBox Function. Common Dialog Control. Making Your Own Dialog Box. Summary. Review Questions. Exercises. 12. The ADO Data Control. Getting at Data. Universal Data Access. Service Providers for OLE DB. The ADO Data Control. ADO Data Control Properties. Using the Data Control. Summary. Review Questions. 13. Data Control Programming. The Recordset Property. Order of Events. Modifying Data Programmatically. Adding Records. Detecting Changes in Data. Data Control Error Handling. Summary. Review Questions. 14. Additional Data Control Topics. Other Data-aware Controls. Displaying the Number of Records. Your Own Record Movement Buttons. Finding Records. Summary. Review Questions. 15. Multiple Document Interface. What Is MDI? Creating an MDI Form. Creating the Employee Tracking System. Child Menus in MDI Applications. Arranging Child Forms. Tracking Child Windows. Creating Pop-up Menus. Unloading an MDI Application. Summary. Review Questions. 16. The Debugger. Three Modes of Visual Basic. The Debug Toolbar. Invoking the Debugger. Quick Watch. Setting the Next Statement to Execute. The Call Stack Window. Setting Breakpoints. The Stop Statement. Setting Watch Variables. Using the Immediate Window. Printing to the Immediate Window. Summary. Review Questions. 17. Error Handling. How Visual Basic Handles Error. Error-handling Techniques. On Error GoTo . The Err Object. Getting a List of Errors. On Error Resume Next. Errors in the Call Stack. Turning Error Handling Off. Creating a Global Error Handler. Summary. Review Questions. Exercises. 18. IDE and Editor Tips and Tricks. Using the Code Editor. Form Editing Tips and Tricks. Changing the IDE. Summary. Review Questions. Exercises. II. INTERMEDIATE VISUAL BASIC. 19. Object-based Programming. Defining Object-based Programming. Object-based Coding Versus Procedural Coding. Converting to Object-based _Programming. Advantages of OOP. Disadvantages of OOP. Summary. Review Questions. 20. Creating Class Modules. Visual Basic Class Modules. Creating a Simple Class. Form Objects. The TextStream Class. Warning About Global Objects. Default Methods and Properties. Summary. Review Questions. Exercises. 21. System Objects. What Is an Object? Object Types. Form and Control Objects. System Objects. The App Object. The Screen Object. The Clipboard Object. Creating New Forms at Runtime. Summary. Review Questions. 22. Collections. What Is a Collection? The Forms Collection. Keeping Track of Form Instances. Checking for Instances of Forms. The Controls Collection. The Printer Collection. The Collection Class. Using the Collection Class. Problems with Public Collections. Create Your Own Collection Class. Adding Iteration. Summary. Review Questions. Exercises. 23. Tips and Tricks. Handling Keystrokes. Validating Data. Control Tricks. The DataFormat Property. The TabIndex Property and the Label Control. Third-Party Controls. Additional Functions in Visual Basic. Summary. Review Questions. 24. ActiveX Data Objects. The Connection Object. The Recordset Object. Opening a Forward-Only Recordset. Error Handling. Command Objects. Summary. Review Questions. Exercises. 25. Data Entry with ADO Objects. Creating a New ADO Project. Adding Data. Editing Data. Deleting Data. Summary. Review Questions. Exercises. 26. Wizards Data Form Wizard. Examples. Application Wizard. Summary. Review Questions. Exercises. 27. Visual Database Tools. Visual Database Tools Overview. Data Environment Designer. Data View Window. The Query Design Window. SQL Editor for Stored Procedures and _Triggers. The Database Diagram Window. Visual Data Manager. Summary. Review Questions. Exercise. 28. Using the Windows API. What Is the Windows API? Uses of the Windows API. Windows Components. ANSI Versus Unicode. Sources for Windows API Information. Declaring API Functions to Visual Basic. Calling API Functions. The SendMessage API Function. Limiting Characters in a Combo Box. The GetDriveType Function. Retrieving System Resources. The About Form. The OSystemGet() Method. The GetSysInfo() Method. Summary. Review Questions. Exercises. 29. Storing User Information. INI Files. INI Class. The System Registry. Built-in Visual Basic Functions. The Registry Class. Summary. Review Questions. Exercises. 30. ActiveX Controls: Part 1. Windows Controls in Visual Basic. The ImageList Control. Toolbar. Coolbar. Status Bar. ImageCombo. Summary. Review Questions. Exercises. 31. ActiveX Controls: Part 2. DateTimePicker Control. The MonthView Control. The Progress Bar Control. The Slider Control. The UpDown Control. The TabStrip. The SSTab Control. Summary. Review Questions. Exercise. 32. Drag and Drop. Drag and Drop Defined. Automatic Drag and Drop. Changing the Drag Icon. No Dropping Here. Manual Drag and Drop. Simplifying Drag and Drop. Summary. Review Questions. 33. Optimization. Speed Optimization Tricks. Size Optimization Tricks. Summary. Review Questions. 34. Package and Deployment Wizard. What's a Setup? Getting Ready to Distribute. Running the P&D Wizard. Deployment Options in the P&D Wizard. What's a Dependency File? What Can You Distribute from Visual Basic? The Setup Toolkit. Testing Your Installation. Summary. Review Questions. Exercise. III. APPENDIXES. Appendix A. VBA Programming Standards. Reasons for Naming Conventions. Environment Options. Custom Control Naming Conventions. Menu Naming Conventions. Naming Conventions for Other Controls. Variable/Object Naming. Variable Data Type Prefixes. Scope Prefixes. User-defined Types. Class Naming. Naming Constants. Variant Data Type. Function and Procedure Naming. Error Labels. Commenting Your Code. Formatting Your Code. Operators. Scope. Summary. Appendix B. Database Standards. Database Naming Standards. Database Naming Conventions. Table Naming. System Tables. Temporary Tables. Column Naming. Summary. Appendix C - Bibliography. Recommended Programming Books. Recommended Standards Books and _Articles. ODBC References. Object-Oriented Programming _References. SQL and Database Books. Periodicals and Conferences. Products from PDSA. Appendix D. Answers to Review Questions. Chapter 1: Visual Basic Overview. Chapter 2: Getting Started. Chapter 3: Controls. Chapter 4: Lists and Menus. Chapter 5: Events Happen. Chapter 6: Variables. Chapter 7: Arrays, Types, and _Constants. Chapter 8: Conditional Logic and _Looping. Chapter 9: Procedures and Functions. Chapter 10: Built-in Visual Basic _Functions. Chapter 11: Dialog Boxes. Chapter 12: The ADO Data Control. Chapter 13: Data Control Programming. Chapter 14: Additional Data Control _Topics. Chapter 15: Multiple Document _Interface. Chapter 16: The Debugger. Chapter 17: Error Handling. Chapter 18: IDE and Editor Tips and _Tricks. Chapter 19: Object-based _Programming. Chapter 20: Creating Class Modules. Chapter 21: System Objects. Chapter 22: Collections. Chapter 23: Tips and Tricks. Chapter 24: ActiveX Data Objects. Chapter 25: Data Entry with ADO _Objects. Chapter 26: Wizards. Chapter 27: Visual Database Tools. Chapter 28: Using the Windows API. Chapter 29: Storing User Information. Chapter 30: ActiveX Controls: Part 1. Chapter 31: ActiveX Controls: Part 2. Chapter 32: Drag and Drop. Chapter 33: Optimization. Chapter 34: Package and Deployment _Wizard. Appendix E. Sample Code Installation Instructions. Getting the Latest Service Pack. Installation Instructions. Index.
Paul D. Sheriff is a recognized leader in the Visual Basic industry. Paul is a frequent speaker at Microsoft Developer Days, Microsoft Tech Ed, Access/VBA Advisor Developer Conferences, and user groups across the country. Paul is a contributing editor to Access/VBA Advisor magazine. You can also see Paul teaching courses with Application Developers Training Company (AppDev). Paul appears in over 35 Visual Basic and SQL Server videos with Keystone Learning Systems.