Visual Basic Concepts
ActiveX controls can be added to any project type. When a control is compiled as part of an .exe file, however, it cannot be shared with other applications. The ShapeLabel control will be compiled into an .ocx file in a later procedure in this chapter, so it can be shared. Thus the ControlDemo project will be created as an ActiveX control project.
An ActiveX control project can contain as many controls as you like. When you build the project, the resulting .ocx file contains all the controls you’ve added.
Note This topic is part of a series that walks you through creating a sample ActiveX control. It begins with the topic Creating an ActiveX Control.
To create the ControlDemo project
Visual Basic automatically adds a UserControl designer to the project. The default name, UserControl1, appears as the caption of the designer.
The name you specify becomes the class name of your control, just as CommandButton is the class name for a command button. "Building ActiveX Controls" provides guidelines for choosing class names for controls.
Notice that the Properties window looks much as it would for a Visual Basic form. Some properties you’re used to seeing are missing, however, and there are properties not found on ordinary Visual Basic forms. These properties are discussed in "Building ActiveX Controls."
This sets the default size of the control. For convenience in later procedures, the ShapeLabel control should be of modest size.
File | Filename | Extension |
User control | ControlDemo_ShapeLabel | .ctl |
Project | ControlDemo | .vbp |
Binary information in a control — such as bitmaps — will be saved in a binary file with the same name and an extension of .ctx.
For More Information See "Setting Up a New Control Project and Test Project" and "Debugging Controls," in "Building ActiveX Controls."
This topic is part of a series that walks you through creating a sample ActiveX control.
To | See |
Go to the next step | Adding the TestCtlDemo Project |
Start from the beginning | Creating an ActiveX Control |