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 19

Building Multiple Projects

Visual Basic makes one other important modification to its menus when a project group is loaded: the addition of the Make Project Group command under the File menu. This will perform a build of every project contained within the current project group, which is sometimes more convenient than selecting and building each project individually. Selecting the Make Project Group option brings up a dialog box, as shown in Figure 19.5, where you can select which projects you would like to build.

The option at the bottom of this dialog box, Use Default Build Options, is very important. If it is selected, Visual Basic will just go ahead and build each of the selected projects using whatever settings you used last, without displaying any dialog boxes to enable you to change these build settings.

The Make Project Group dialog box enables you to select which projects to build.
FIGURE 19.5 The Make Project Group dialog box enables you to select which projects to build.

If you have never built a project before, and this option is selected, the system will use the standard defaults shown for a first build (save in current folder, name is same as project name, and so on). If you do not have this option checked, the standard build dialog box will come up for each project in turn, prompting you to either accept or change the current settings. If you are using the Make Project Group command with the intention of starting all your projects compiling while you go away and do something else, you should ensure that this option is checked.

Another important difference when you have multiple projects loaded is that you need to let Visual Basic know which one is the main, or startup project. This project is the one that will run when you press F5 or choose Start from the Run menu. All other projects are only run if they are instantiated by that main project. A project is considered instantiated by another project if it is started through some type of ActiveX call, such as CreateObject.

The first project placed in a group is, by default, the startup project, but this can be changed through the Project Explorer. If you rightclick within any of the projects in the Project Explorer window, you will see the menu option Set as Start Up (see Figure 19.6). If you select that option, the project that was currently selected is now designated the startup project. To indicate its status, the startup project’s name is shown in bold in the Project Explorer.

Set this project to be the startup project.
FIGURE 19.6 Set this project to be the startup project.

Generally, the choice of which project should be the main project is obvious to the developer. It is the one that calls or references all the others. It is sometimes necessary, however, to change the startup project while testing.

Any project that can be run on its own can be a startup project, which means any type of project other than an ActiveX control (refer back to Figure 19.6).

NOTE - Setting the Startup Project: Always ensure that your startup project is set correctly when dealing with ActiveX objects. ActiveX DLLs in particular, when accidentally set to be the startup group, can cause some puzzling results. Usually, because the DLL probably doesn’t have any code that runs without a client application calling it, there are no visible results of starting the project group. You will see Visual Basic remain in Execution mode (Start button grayed, Pause and Stop buttons enabled), but nothing else will happen. This might cause you to frantically look for errors in your main project (the one you intended to be the startup), without finding anything. Remember to always look for the bold project name as proof of the current startup project.

NOTE - To Which Project Am I Adding? Other than the previously mentioned options, the Project Explorer behaves the same when dealing with a project group as it does for a single project. The project affected by the various Add commands, such as for forms and modules, is always the currently selected one.


<< Previous | Contents | Next >>

Home | About Us | Privacy Policy | Contact Us

Copyright © | All Rights Reserved