Share via


Visual Basic Concepts

Creating the Coffee Project

This topic creates the Coffee project, with its CoffeeMonitor class and its TestForm form class.

Note   This topic is part of a series that walks you through creating a sample ActiveX EXE. It begins with the topic Creating an ActiveX EXE Component.

To create the Coffee project

  1. On the File menu, click New Project.

  2. In the New Project dialog box, double-click the ActiveX EXE icon. Visual Basic automatically adds a class module, Class1, to the new project.

  3. Press F4 to switch to the Properties window. Double-click the Name property and change it to CoffeeMonitor. This is the name you’ll use to create objects from the class.

    The default value for the Instancing property is MultiUse. This allows clients to create multiple instances of the CoffeeMonitor class. For a full discussion of the Instancing property, see "Instancing for Classes Provided by ActiveX Components," in "General Principles of Component Design."

  4. On the Project menu, click Project1 Properties to open the Project Properties dialog box. Select the General tab, fill out the information shown below, then click OK.

    The project name, Coffee, is also used as the name of the component’s type library. It can be combined with the name of each class the component provides, to produce unique class names.

    If two components each provide a CoffeeMonitor class, the fully qualified class name lets you specify which component’s CoffeeMonitor class you want to use, for example, Coffee.CoffeeMonitor.

  5. On the Project menu, click Add Form to open the Add Form dialog box. Double click the Form icon to add a form to the project.

    Note   If you’ve used the Options dialog box (accessed from the Tools menu) to disable the Add Form dialog box, you’ll just get the form. This is okay.

  6. Press F4 to open the Properties window. Change the following property settings:

Object Property Setting
Form (Name)
Caption
TestForm
TestForm - Modal
  1. On the File menu, click Save Project to save the project files, using the following names. Visual Basic will provide the extensions automatically.
File File name Extension
Form Coffee_TestForm .frm
Class module Coffee_CoffeeMonitor .cls
Project Coffee .vbp

For More Information   See "Choosing a Project Type and Setting Project Options" in "General Principles of Component Design."

Step by Step

This topic is part of a series that walks you through creating a sample ActiveX EXE.

To See
Go to the next step Showing Forms from the CoffeeMonitor Class
Start from the beginning Creating an ActiveX EXE Component