Use project
When you develop an application, you use a project to manage all the different files that make up the application. A project includes:
1. Track the project files (.vbp) of all components.
2. File (.frm) for each form.
3. The binary data file (.frx) of each form, which contains the property data of the controls on the form. Any .frm files containing binary attributes (such as pictures or icons) are not editable; these files are automatically generated.
4. One file (.cls) for each class module, this file is optional.
5. One file (.bas) for each standard module, this file is optional.
6. One or more files (.ocx) containing ActiveX controls, this file is optional.
7. A single resource file (.res), this file is optional.
The project file is a list of all files and objects related to the project, as well as information about the environment options that are set. This information is updated each time the project is saved. All these files and objects can also be shared with other projects.
When all files of the project are completed, you can convert the project into an executable file (.exe): From the "File" menu, select the "Make PRoject.exe" command.
Note that using the Professional and Enterprise editions of Visual Basic, you can also create other types of executable files, such as .ocx and .dll files. This chapter assumes that we are talking about a standard .exe project. For additional information on other project types, see the Component Tool Guide in Professional and Enterprise editions.
More information For more information about creating executable files, see "Making and Running Executable Files" later in this chapter. For information about binary data files and project files, see Appendix A, "Visual Basic Specifications, Limitations, and File Format."
Project Explorer
When you create, add, or delete editable files from a project, Visual Basic reflects the changes in the Project Explorer window, which contains a list of the project's current files. The Project Explorer window shown in Figure 4.1 lists some file types that can be included in Visual Basic projects.
Project documents
Every time you save the project, Visual Basic updates the project file (.vbp). The project file contains a file list that is the same as the file list that appears in the Project Explorer window. The project file also references ActiveX controls and pluggable objects used in the project. You can open an existing project file by double-clicking its icon, selecting the Open Project command from the File menu, or dragging the file into the Project Explorer window.
Details The specified format of information is stored in the .vbp file, which is described in the Appendix AVisualBasic Specifications, Limitations, and File Format.
The structure of a VisualBasic project
The following sections describe the different types of files and objects that can be included in your project.
form module
A form module (with a .frm file extension) contains a textual description of the form and its controls, including their property settings. They also contain declarations of form-level constants, variables, and external procedures, event procedures, and general procedures.
For more information on creating forms, see Chapter 2, "Developing Applications with Visual Basic" and Chapter 6, "Creating User Interfaces." For information about the format and contents of form files, see Appendix A, "Visual Basic Specifications, Limitations, and File Format."
Class Modules Class modules (with a .cls file extension) are similar to form modules, except that they do not have a visible user interface. You can use class modules to create your own objects that contain method and property code.
For more information about writing code in class modules, see "Creating Your Own Classes" in Chapter 9, "Programming with Objects."
Standard module
Standard modules (with a .bas file extension) can contain public or module-level declarations of types, constants, variables, external procedures, and public procedures.
For more information about using modules, see Chapter 5, "Programming Fundamentals," and Chapter 9, "Programming with Objects."
Resource file
Resource files (with a .res file extension) contain bitmaps, strings, and other data that can be changed without re-editing the code. For example, if you plan to localize your application in a foreign language, you can store the entire text string and bitmap of the user interface in a resource file and then localize the resource file instead of localizing the entire application. A project contains at most one resource file.
For details about using resource files, see "Using Resource Files" later in this chapter and Chapter 16, "International Distribution".
ActiveX document
ActiveX documents (.dob) are similar to forms, but can be displayed in an Internet browser such as Internet Explorer. The Professional and Enterprise editions of VisualBasic are capable of creating ActiveX documents.
For more information about ActiveX documents, see "Creating ActiveX Components" in the "Microsoft Visual Basic 6.0 Component Tool Guide", available in the Professional and Enterprise editions.
User controls and property page modules
User control (.ctl) and property page (.pag) modules are also similar to forms, but they are used to create ActiveX controls and their associated property pages that display design-time properties. The Professional and Enterprise editions of Visual Basic can create ActiveX controls.
For more information about creating ActiveX controls, see "Creating ActiveX Components" in the "Microsoft Visual Basic 6.0 Component Tool Guide", available in the Professional and Enterprise editions.
part
In addition to files and modules, there are several other types of components that can be added to a project.
ActiveX control
ActiveX controls (with the .ocx file extension) are optional controls that can be added to the toolbox and used in forms. When VisualBasic is installed, the files containing controls included in VisualBasic are copied to a public directory (subdirectory /Windows/System under Windows95). Additional ActiveX controls are available from a variety of sources. You can also create your own controls using Visual Basic Professional and Enterprise editions.
For more information about using the included ActiveX controls, see the Microsoft Visual Basic 6.0 Component Tools Guide, available in the Professional and Enterprise editions.
Insertable objects
Insertable objects, such as Microsoft Excel's worksheet objects, are components that can be used as building blocks when building integrated solutions. An integrated schema can contain data in different formats, such as worksheets, bitmaps, and text, created by different applications.
For more information about using objects from other applications, see Chapter 10, "Programming with Components."
Quote
You can also add references to external ActiveX components that can be used by the application. You can specify references using the References dialog box by accessing the References menu item on the Project menu.
For more information about references, see "Using Objects from Other Applications" later in this chapter.
ActiveX Designer
ActiveX Designer is a class design tool that can create objects starting from classes. The form's design interface is the default designer. Additional designers are available from other sources. For more information about the ActiveX Designer, see "ActiveX Designer" in Chapter 9, "Programming with Objects."
Standard controls
Standard controls are provided by Visual Basic. Standard controls, such as command buttons or frame controls, are always included in the toolbox, unlike ActiveX controls and pluggable objects that can be added and removed from the toolbox.
For more information about standard controls, see Chapter 3, "Forms, Controls, and Menus" and Chapter 7, "Using Visual Basic's Standard Controls."
Create, open and save projects
Four commands on the File menu allow you to create, open, and save projects.
Files can be shared between projects. A single file like a form can be part of multiple projects. Note that changes made to a form or module in one project will be propagated to all projects that share this module.
For more information about sharing files, see "Adding, Deleting, and Saving Files" later in this chapter.
Use multiple projects
In the Professional and Enterprise editions of Visual Basic, multiple projects can be opened at the same time. This capability is useful when building and testing solutions with user-created controls or other components. When multiple projects are loaded, the title of the Project Explorer window changes to "Project Group" and all open project components are displayed.
To add additional projects to the current project group, follow these steps:
1. Select "Add Project" from the "File" menu. The "Add Project" dialog box is displayed.
2. Select an existing project or a new project type and select "Open".
To delete a project from an existing project group, follow these steps:
1. Select a project or a project component in the "Project Explorer".
2. Select "Delete Project" in the "File" menu.
For more information about using multiple projects, see "Creating ActiveX Components" in the Microsoft Visual Basic 6.0 Component Tools Guide, available in the Professional and Enterprise editions.
->