Freetutes.com

VB6 beginners tutorial - Learn VB6

Advanced VB6 tutorial - Learn Advanced VB6

VB .NET - Learn Visual Basic .NET

Systems Analysis - System analysis and Design tutorial for Software Engineering


You are here: Visual Basic > Advanced VB6 tutorial > Chapter 20

Using Compile On Demand

Compile on demand doesn’t really make your code execute any faster, but it may save you time just the same. The time savings comes from quicker loading of your application when you run it in Debug mode. To use it, pull down the Tools, Options menu and choose the General tab. Figure 20.21 shows this tab.

The two check boxes in the Compiler group determine how this feature operates. If you check the Compile On Demand box, VB no longer will perform a full compilation of your project before running it in Debug mode. Instead, VB will compile only as much as it needs to start your project. After the application is running, it will then compile your code on an as-needed basis.

If you have two command buttons on a form, for example, the code behind each button won’t be compiled unless you click on the button while the application is running. Because you have asked to execute the code for the button’s Click event, that portion of your code will be compiled. If there are no errors, the code executes at once. If there are compiler errors, however, a message box informs you of the problem and gives you a chance to fix your code.

The Compile On Demand option on the General tab.
FIGURE 20.21 The Compile On Demand option on the General tab.

The main advantage of compile on demand is that you don’t have to get every bug out of your project to test one particular part of it. You may discover that some of your code for a list box won’t compile, for instance, but now you don’t have to remove that code (or comment it out) just to test the code for a set of command buttons. If compile on demand is activated, you can test each portion of your project independently.

The Background Compilation switch is available only if you also select Compile On Demand. With this switch activated, VB will try to compile additional portions of your application even if you haven’t tried to use them yet. The compiler accomplishes this by waiting for idle time while you test the project. It won’t notify you of compilation errors unless you have specifically tried to use a feature, but any successful compilations will be available instantly when you are ready to use them.


  

<< Previous | Contents | Next >>

Home | About Us | Privacy Policy | Contact Us

Copyright © Freetutes.com | All Rights Reserved