Sams Teach Yourself Visual Basic 6 in 24 Hours
- Table of Contents
- Copyright
- About the Author
- Acknowledgments
- Introduction
- Who Should Read This Book
- What This Book Will Do for You
- Can This Book Really Teach Visual Basic in 24 Hours?
- What You Need
- Files on the Visual Basic Distribution CD-ROM
- Conventions Used in This Book
- Enough! Time Is Ticking!
- Part I: Introducing Visual Basic
- Hour 1. Visual Basic at Work
- Hour 2.Analyzing Visual Basic Programs
- Hour 3.Controls and Properties
- Hour 4.Examining Labels, Buttons, and Text Boxes
- Part II: Coding the Details
- Hour 5.Putting Code into Visual Basic
- Hour 6.Message and Input Boxes
- Hour 7.Making Decisions
- Hour 8.Visual Basic Looping
- Part III:Putting Code to Work
- Hour 9.Combining Code and Controls
- Hour 10.List Boxes and Data Lists
- Hour 11.Additional Controls
- Hour 12.Dialog Box Basics
- Part IV:Programming with Data
- Hour 13.Modular Programming
- Hour 14.Built-In Functions Save Time
- Hour 15.Visual Basic Database Basics
- Hour 16.Printing with Visual Basic
- Part V:Sprucing Up Programs
- Hour 17.Menus and Visual Basic
- Hour 18.The Graphic Image Controls
- Hour 19.Toolbars and More Graphics
- Hour 20.Writing Correct Applications
- Part VI:Advancing Visual Basic Applications
- Hour 21.Visual Basic and ActiveX
- Hour 22.Object Basics
- Hour 23.Distributing Your Applications
- Hour 24.Online Visual Basic
- Part VII:Appendixes
- Appendix A.Operator Precedence
- Appendix B.Answers
- Appendix C.Using the CD-ROM
Q&A
-
How do I know which events to respond to when so many events can happen at any time?
Your application's requirements determine the events you respond to in the application, nothing else. For example, if your application has no need to respond to a mouse click over a label you've placed on the form, don't write an event procedure for that label's Click event. If the user clicks over the label, Windows will send a message signaling the event to your program, but your program simply lets the event pass through and never responds to the event.
-
Why should I not compile my application before I run it, if compiling the application makes it more efficient?
When you compile an application, Visual Basic translates your source code project into an executable program. The executable program often takes less disk space than all the source files, and the executable program is easier to distribute. Nevertheless, when you develop and test an application, you don't want to compile the application every time you run it to test the application and see the results. As a matter of fact, don't compile your application until you have completely finished the application and are about to distribute it to others. The compiled application is safe from modifications because a compiled program is virtually impossible to change without ruining the application's executable file. In addition, the compiled file will be faster than the project that you run from inside the development environment. Nevertheless, during development, you don't care about speed, but you do care about bugs. During debugging test runs, you want your project to execute as soon as you request it, without taking the extra time necessary to compile each time.
-
What is the difference between a form module and a standard module?
A form module always goes with its form. The form holds controls, remember, and each of those controls can trigger and respond to events. The event procedure code that you write for the form's controls must reside in that form's form module. General-purpose routines, such as common calculations that several applications must share, should go in a standard module with the .bas filename extension. By the way, not only can other applications utilize standard module files, but you can add the same form and form module to multiple applications as well. The application's Project window will take care of the bookkeeping details.
Workshop | Next Section

Account Sign In
View your cart