Software Development

Working with project groups in VB6

There may be times when you need to work on more than one project at the same time because the projects are dependent on each other in some way. Learn the ins and outs of working with project groups in VB6.

There are many VB6 development tasks that you can accomplish within a single project. However, you may need to work on more than one project at the same time because the projects are dependent on each other in some way.

For example, say you're working on an ActiveX control project at the same time that you're working on a Standard EXE project that uses the ActiveX control. In situations such as this, you can have two or more projects open at the same time in a group. When you save the group, you save information about all the contained projects. Later, you can open the group, and all the contained projects will open at the same time. You can also open each project independently, regardless of whether it's part of a group.

How to create a group

First, open or create the first project in the group. Then, you can add an existing or new project to the group by selecting Add Project from the File menu. VB will display the Add Project dialog box. Use the New tab to add a new project or use the Existing tab to add an existing project.

When you have two or more projects open, the Project window lists each one, arranging forms and other project components hierarchically under the project name. You can remove a project from the group by right-clicking it in the Project window and selecting Remove Project from the pop-up menu. Removing a project from a group doesn't affect the project files on the disk.

VB groups save as VBG files. To save a group, select Save Project Group from the File menu. (Saving the group also saves the individual projects.)

When you're working with a group, VB needs to know which project is the startup project. To set this, right-click a project name in the Project window and select Set as Startup from the pop-up menu. By default, the first .EXE project that you add to a group is the startup project. Of course, any group can have only one startup project.

Advance your scripting skills to the next level with TechRepublic's free Visual Basic newsletter, delivered each Friday. Automatically sign up today!

4 comments
Rob C
Rob C

I have avoided using groups, just to keep life simple. No doubt there are occasions when they are needed. Sometimes a downloaded example is in a group, when it need not be. EG if there is a user control (ctl) being used. I usually re-create the project, and add the user control, AND I DON'T USE A VBG My question is - When you decide to make an exe,in a vbg project, is it one exe for the whole group ?

MichaelPaulukonis
MichaelPaulukonis

I started using group, just to keep life simple. Instead of having multiple instances of the VBE open, I now have all the inter-related projects in one place. Plus, I can compile them all at the same time. woo! I don't think you could make an exe for the whole group, as each project has it's own exe, dll, etc.

Ruturaaj
Ruturaaj

I agree with the first comment that sometimes the Open Source code projects found on a certain websites are VBGs where as it would have been better to borrow the DLL or OCX to the other project if those are kept individual projects. However, it certainly plays an important role when you are working on a project which is split into different projects. Unfortunately VB6 IDE does not have a tabbed interface; so having all projects opened at once as a Group is a nice thing! Personally I avoid using VBG when I'm writing a self-contained UserControl or Class to handle something. This way I manage to keep these files Private and hence simply Add Class or Add UserControl makes it all for me. However, I strictly prefer to VBG when I'm working on a project where two executable files are required to communicate with each other (may be via command line param) or a DLL/COM is expected to be used in compiled form and not embedded directly into main project.

Editor's Picks