Visual Basic Concepts

The Structure of a Visual Basic Project

The following sections describe the different types of files and objects that you can include in a project.

Form Modules

Form modules (.frm file name extension) can contain textual descriptions of the form and its controls, including their property settings. They can also contain form-level declarations of constants, variables, and external procedures; event procedures; and general procedures.

For More Information   For more about creating forms, see "Developing an Application in Visual Basic" and "Creating a User Interface." For information about the format and content of form files, see "Visual Basic Specifications, Limitations, and File Formats."

Class Modules

Class modules (.cls file name extension) are similar to form modules, except that they have no visible user interface. You can use class modules to create your own objects, including code for methods and properties.

For More Information   For information about writing code in class modules, see "Creating Your Own Classes" in "Programming with Objects."

Standard Modules

Standard modules (.bas file name extension) can contain public or module-level declarations of types, constants, variables, external procedures, and public procedures.

For More Information   For information about using modules, see "Programming Fundamentals" and "Programming with Objects."

Resource Files

Resource files (.res file name extension) contain bitmaps, text strings, and other data that you can change without having to re-edit your code. For example, if you plan to localize your application in a foreign language, you can keep all of the user-interface text strings and bitmaps in a resource file, which you can then localize instead of the entire application. A project can contain no more than one resource file.

For More Information   For more information on using resource files, see "Using a Resource File" later in this chapter, and "International Issues."

ActiveX Documents

ActiveX documents (.dob) are similar to forms, but are displayable in an Internet browser such as Internet Explorer. The Professional and Enterprise editions of Visual Basic are capable of creating ActiveX documents.

For More Information   For more information on ActiveX documents, see "Creating ActiveX Components" in the Component Tools Guide.

User Control and Property Page Modules

User Control (.ctl) and Property Page (.pag) modules are also similar to forms, but are used to create ActiveX controls and their associated property pages for displaying design-time properties. The Professional and Enterprise editions of Visual Basic are capable of creating ActiveX controls.

For More Information   For more information on ActiveX control creation, see "Creating an ActiveX Control" in "Creating ActiveX Components," in the Component Tools Guide.

Components

In addition to files and modules, several other types of components can be added to the project.

ActiveX Controls

ActiveX controls (.ocx file name extension) are optional controls which can be added to the toolbox and used on forms. When you install Visual Basic, the files containing the controls included with Visual Basic are copied to a common directory (the \Windows\System subdirectory under Windows 95 or later). Additional ActiveX controls are available from a wide variety of sources. You can also create your own controls using the Professional or Enterprise editions of Visual Basic.

For More Information   For more information on using the included ActiveX controls, see "Using the ActiveX Controls" in the Component Tools Guide.

Insertable Objects

Insertable objects, such as a Microsoft Excel Worksheet object, are components you can use as building blocks to build integrated solutions. An integrated solution can contain data in different formats, such as spreadsheets, bitmaps, and text, which were all created by different applications.

For More Information   For more information on using other applications' objects, see "Programming with Components."

References

You can also add references to external ActiveX components that may be used by your application. You assign references by using the References dialog, accessed from the References menu item on the Project menu.

For More Information   For more information on references, see "Using Other Applications' Objects" later in this chapter.

ActiveX Designers

ActiveX designers are tools for designing classes from which objects can be created. The design interface for forms is the default designer. Additional designers may be available from other sources.

For More Information   For more information about ActiveX designers, see "ActiveX Designers" in "Programming with Objects."

Standard Controls

Standard controls are supplied by Visual Basic. Standard controls, such as the command button or frame control, are always included in the toolbox, unlike ActiveX controls and insertable objects, which can be removed from or added to the toolbox.

For More Information   For more information on standard controls, see "Forms, Controls, and Menus" and "Using Visual Basic's Standard Controls."