Use of engineering
When developing an application, you use engineering to manage all the different files that make up your application. A project includes:
1. Track all parts of the engineering document (. vbp).
2. Each form's file (. frm).
3. A binary data file (. frx) for each form that contains property data for controls on the form. Any. frm files that contain binary attributes, such as pictures or icons, are not editable, and these files are automatically generated.
4. A file (. cls) for each class module, which is optional.
5. A file (. bas) for each standard module, which is optional.
6. One or more files (. ocx) containing ActiveX controls, which are optional.
7. A single resource (. res) file, which is optional.
An engineering document is a list of all the files and objects associated with the project, as well as information on the environmental options set. This information is updated each time the project is saved. All of these files and objects are also available for other projects to share.
After completing all of the project's files, you can convert the project to an executable file (. exe): From the File menu, select the Make Project.exe command.
Note You can also create other types of executables, such as. ocx and. dll files, using Professional and Enterprise editions of Visual Basic. This chapter assumes that the standard. EXE project is being addressed. For additional information related to other engineering types, refer to the Part Tools guide in both Professional and Enterprise editions.
For more information about creating an executable file, see "Making and running an executable file" later in this chapter. For information about binary data files and engineering files, see Appendix A, "Guidelines, restrictions, and file formats for Visual Basic."
Project Explorer
When you create, add, or delete an editable file from a project, Visual Basic reflects the changes that have occurred in the Project Explorer window that contains a list of the current files for this project. The Project Explorer window shown in Figure 4.1 lists some of the file types that can be incorporated into the Visual Basic project.
Engineering documents
Each time you save the project, Visual Basic updates the project file (. vbp). The project file contains a list of files that are the same as the list of files that appear in the Project Explorer window, and the project files refer to the ActiveX controls and pluggable objects used in the project. You can open this existing project file by double-clicking an existing project icon, or by selecting the Open Project command from the File menu, or by dragging the file into the Project Explorer window.
The specified format for details information is stored in the. vbp file, which is described in appendix A, "VisualBasic specifications, restrictions, and file formats."
Structure of Visual Basic engineering
The following sections describe the different types of files and objects that can be incorporated into the project.
form module
A form module (with a. frm file name extension) contains the body descriptions 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 about creating forms, see chapter II, "Developing applications in Visual Basic" and chapter sixth "Creating a user interface." For information about the format and content of form files, see Appendix A, "Guidelines, restrictions, and file formats for Visual Basic."
A class module class module (with a. cls file name extension) is similar to a form module, except that there is no visible user interface. You can use class modules to create your own objects that contain methods and property codes.
For more information about writing code in a class module, see "Creating Your Own Class" in Chapter Nineth, "Programming with objects."
Standard modules
A standard module (with a. bas file name extension) can contain a public or module-level declaration of types, constants, variables, external procedures, and public procedures.
For more information about using modules, see Chapter Fifth, "Programming Basics" and Chapter Nineth, "Programming with objects."
Resource file
A resource file (with a. res file name extension) contains bitmaps, strings, and other data that can be changed without having to edit the code again. For example, if you plan to localize your application in a foreign language, you can store all the body strings and bitmaps of the user interface in a resource file, and then localize the resource files instead of localizing the entire application. A project contains a maximum of one resource file.
For more information about using resource files, see "Working with Resource Files" and chapter 16th "International Offerings" later in this chapter.
ActiveX Document
An ActiveX document (. Dob) is similar to a form, but can be displayed in an Internet browser such as Internet Explorer. Specialized and Enterprise editions of Visual Basic can create ActiveX documents.
For more information about ActiveX text, see "Creating an ActiveX widget" in the Microsoft Visual Basic6.0 parts Tools guide, available in both Professional and Enterprise editions.
User Control and Property page modules
The user control (. ctl) and Property page (. Pag) modules are also similar to forms, but they are used to create ActiveX controls and property pages associated with them to display design-time properties. 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 VisualBasic 6 Tools Guide, available in both Professional and Enterprise editions.
Parts
In addition to files and modules, there are several other types of parts that can be added to the project.
ActiveX Control
An ActiveX control (with an. ocx file name extension) is an optional control that can be added to the toolbox and used in a form. When Visual Basic is installed, Visual Basic contains files containing controls that are replicated to a common directory (the subdirectory \Windows\System under Windows 95). Additional ActiveX controls can be obtained from a variety of sources. You can also use Visual Basic Professional and Enterprise editions to create your own controls.
For more information about using the included ActiveX controls, see the MicrosoftVisual Basic 6 Tools Guide, available in both Professional and Enterprise editions.
Objects that can be inserted
Pluggable objects, such as worksheet objects for Microsoft Excel, are parts that can be used as building blocks for building integration scenarios. An integration scenario can contain data in different formats that are created by different applications, such as worksheets, bitmaps, and body text.
For more information about objects that use other applications, see Chapter Tenth, "Programming with parts."
Reference
You can also add a reference to an external ActiveX part that can be used by the application. You can use the Reference dialog box to specify a reference by accessing the References menu item on the Project menu.
For more information about references, see "Objects with other applications" later in this chapter.
ActiveX Designer
The ActiveX Designer is the design tool for classes that allow you to create objects from classes. The design interface for a form is the default designer. Additional designers can be obtained from other sources. For more information about the ActiveX Designer, see the "ActiveX Designer" in Chapter Nineth, "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 removed from the toolbox.
For more information about standard controls, see chapter III, "Forms, controls, and menus," and chapter seventh, "Standard controls with Visual Basic."
Create, open, and save a project
The four commands on the File menu allow you to create, open, and save the project.
Files can be shared among engineering. A single file, such as a form, can be an integral part of multiple projects. Note that changes made to a form or module in a project will be propagated to all projects that share the module.
For more information about sharing files, see "Adding, deleting, and Saving files" later in this chapter.
Using multiple projects
In the Professional and Enterprise editions of Visual Basic, you can open multiple projects at the same time. This is useful when you are building and testing a solution for a user-created control or other part. When multiple projects are loaded, the title of the Project Explorer window becomes an "engineering group," and all open engineering parts are displayed.
To add additional work to the current engineering group, follow these steps:
1. Choose Add Project from the File menu. The Add Project dialog box is displayed.
2. Select an existing project or a new project type and choose Open.
To remove a project from an existing engineering group, follow these steps:
1. Select a project or an engineering component in the Project Explorer.
2. Choose Delete Project from the File menu.
For more information about using multiple projects, see "Creating an ActiveX widget" in the Microsoft VisualBasic 6 Tools Guide, available in both Professional and Enterprise editions.