Sams Teach Yourself Visual Basic 6 in 24 Hours

Sams Teach Yourself Visual Basic 6 in 24 Hours

By Greg Perry

Q&A

  1. 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.

  2. 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.

  3. 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.

Share ThisShare This

Informit Network