Using a Component's Visual Interface

See Also

If a component supports object linking and embedding (OLE), you can link or embed an object into your application without writing any code by using the component's visual interface. You can use a component's visual interface in one of two ways:

Inserting an Object with the OLE Container Control

The OLE container control gives you the most flexibility in using an object's visual interface. With the OLE container control, you can:

An OLE container control can contain only one object at a time. There are several ways to create a linked or embedded object in the OLE container control — the one you choose depends on whether you are creating the linked or embedded object at design time or run time. Once you have an OLE container control drawn on your form, you can insert an object into the container control by:

For More Information   For more information on using the OLE container control, see "OLE Container Control" and "Containers for Controls" in "Using Visual Basic's Standard Controls."

Inserting an Object by Adding Its Class to the Toolbox

In the same way that you use the Toolbox to add one of Visual Basic's built-in controls to an application, you can use the Toolbox to add an object. First, add the object's class to the Toolbox, then add the object to a form.

To add an object's class to the Toolbox

  1. From the Project menu, choose Components.

  2. In the Components dialog box, click the Insertable Objects tab.

  3. Select the class you want to add to the Toolbox, then click OK. Visual Basic adds a button of that class to the toolbox.

    For example, to add a Microsoft Excel Worksheet button to the Toolbox, select Microsoft Excel Worksheet.

Once you've added the object's class to the Toolbox, you can draw it on a form to create an object of that class. For example, after you add a Microsoft Excel Worksheet button to the Toolbox, you can draw it on a form to create a worksheet object on the form.