VB2022 VB2019 VB6 VB Sample Codes About Us

Lesson 36 : Compiling and Distributing VB Application


36.1 Compiling your Visual Basic Program

Once you have completed a VB program, you can compile the program to run as a standalone Windows application, without having to launch the Visual Basic IDE. However, before you compile your program, you have to debug your program to make sure it is errors free. Once the program is compiled into an EXE file (executable file), you cannot debug it anymore. If you wish to do so, you have to correct the errors and recompile it.

To start compiling your program, click on the menu File and select Make Project1.exe, as shown in Figure 36.1. When you click on Make Project1.exe , the Make Project dialog box will appear, as shown in Figure 36.2. In this dialog box, assign a file name to this project and save it in the folder chosen by you. After clicking the OK button, the project properties dialog will appear where you can select the project you wish to compile, as shown in Figure 36.3. In this example, the project we chose to compile is reversi. The option button in this dialog box let you customize the program you are going to compile. For example, you can enter the title of the program , the program's version and your company name. Clicking on the compile tab will let you decide the kind of code you wish to compile, as shown in Figure 36.4. The default option is native code; this is the best option because it normally runs faster. Once you have done that, you can click the OK button to compile the program. Now your program can run as a standalone application.

Figure 36.1

Figure 36.2

Figure 36.3

Figure 36.4

36.2 Distributing Your Programs

After successfully created a VB program, you might want to market your product, either online or offline. This means that you need to create a package that can be distributed to your potential customers. The package created can be distributed using CD ROM, DVDROM or the Internet. The package will allow the user to install the program in the computer with the standard setup routine.

To create the distributable package, you can use the Package and Development Wizard that came with Visual Basic 6. The main purpose of this wizard is to create a setup program that can be used to install the application. Off course, it also does many other jobs like compiling your application and compresses the files for easy distribution.


When you start the Package and Development Wizard, you will be presented with the following dialog box as shown in Figure 36.5:

Figure 36.5

First of all, you need to select the project you want to package. Here we have selected the starwar.vbp project. Next, you need to select one of the three options. Here, I suggest you select the first option to let the wizard create the installation package  for you to distribute it using CD ROM or the Internet.

Once you click the package option, you will see the following dialog box where you are asked to choose a packaging script, as shown in Figure 36.6:

Figure 36.6

Figure 36.7

After clicking the next button, you will see the following dialog box that allows you to choose a packaging type as shown in Figure 37.7. Usually we choose the Standard Setup Package.


The next dialog box that shows up will ask you where to store the package, as shown in Figure 36.8 below:

Figure 36.8

The next dialog box will show you the files that will be included in the package.

When you click the Finish button, the package will be created and ready for distribution. Here is the packaged files for the starwar program for download at

Setup.exe

SETUP.LST

starwar5.CAB

You must download all the three files into a folder and then run the setup program.

❮ Previous Lesson Next Lesson ❯


Copyright©2008 Dr.Liew Voon Kiong. All rights reserved |Contact|Privacy Policy