Compiling a Large VB Project

willisp used Ask the Experts™
I have a VB project which contains an MDI Form, 30 child forms, and 50 classes. It takes about 15 minutes just to compile this project, even when I only change one class or form.  How can I speed this up? What is the standard or recommendation for projects this large?  Should I put the classes into a seperate projoct and build them as ActiveX Dlls?

Any help is appreciated.  Thanks in advance.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Hello willisp !

It depends on what you have to "share".

1. For example if you have to share an arithmetic function you should use a dll (faster because in same process).

2. If you have to share a group of controls used often you should consider using an ocx (user control).

3. If you have to share a copmlete project which offers services to other apps asynchonous you should consider using an ActiveX-Exe.

Set the project type to "binary compatibity" to avoid unnecessary compiling when the interface hasn't changed.



Hi VK,

Thanks for the comments, but I noticed that the "binary compatibility" is disabled and I cannot select it.
Try compiling it from the command line to free up the memory used to "draw" the VB environment.  do it as follows.

<Path to VB.EXE> /make <path of project to compile> /out <path to log file>


"C:\Program Files\Microsoft Visual Studio\VB98\vb6.exe" /make "C:\test\test.vbp" /out c:\compile.log
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

"just to compile" - do you mean build?  There's not much you can do about that because it needs to build each of your objects.  Get a (much) faster PC is the unhelpful suggestion.

If you mean to start the program, you could try starting without full compile each time. (F5 instead of cntrl-F5 or in options).

If you're building an exe to test it, then try testing it from within the IDE instead (even if it's an ActiveX Exe)

... "binary compatibility" is disabled and I cannot select it.

Binary compatibility is only allowed on ActiveX DLLs and ActiveX EXE projects.  I'm assuming yours is a Standard EXE.

Almost all the projects I work on keep all the forms and classes separate.  In addition, I never have more than 10 forms in one project.  I compile all into DLLs. My forms would be compiled into a User Interface (UI) dll and the classes into your Business Objects (BO) DLL.  In this way, if I need to fix something, I am only changing small parts of a whole.  Also, if I ever decide to change my interface, say from VB forms to a Web interface, my objects and business logic are self contained and ready to go.
There's a product I can suggest for this called VB-Build.  You set up the parameters of your project one time, and whenever you need to compile after that it will automatically re-build the objects that have changed and/or any dependencies.  Its quite fast and prevents the beating of opening a project, compiling, opening another, compiling, and so on. 

Note that I don't work for the guys that make this product, we just use it at my office and its quite good for this kind of thing.

Hello willisp !

In general it is better to split your project into components instead of using tools which make it easier (or faster)to compile it.

You can choose binary compatibilty for ActiveX-EXE and ActiveX-DLL. For a normal EXE you don't need it because you haven't any interface to another app by design.


You have a Module (bas) containing hunderts of arithmetic functions. Inatead of compiling them every time you decide to take them into a ActiveX-DLL:

1. Begin a new Project (ActiveX-DLL)
2. Add a class (must be public)
3. Copy all the functions you have in the module into the class
4. If there are any non public functions convert them to public
5. Set the compatibility of the project to binary (possible if you already created a dll, not the first time)
6. Compile your new Project (remember your project name and the name of the public class)
7. In your origin project add a referece to the new created compiled project (see 5.)
8. Dim myClass as myDLLProject.myDLLClass
9. Set myClass = new myDLLProject.myDLLClass

then you can use the functions like (example):
 msgbox myClass.roundit(2.55,2)


Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial