Export (0) Print
Expand All

Visual Basic Reference

Visual Studio 6.0

OLE Container Control

See Also    Example    Properties    Methods    Events

The OLE container control enables you to add insertable objects to the forms in your Visual Basic applications. With the OLE container control, you can:

  • Create a placeholder in your application for an insertable object. At run time you can create the object that is displayed within the OLE container control or change an object you placed within the OLE container control at design time.

  • Create a linked object in your application.

  • Bind the OLE container control to a database using the Data control.

You either create the object at design time using the Insert Object dialog box (which contains the commands Insert Object, Paste Special, and so on), or at run time by setting the appropriate properties.

When you move an OLE container control on a form using the ObjectMove method, the Height and Width property values of the object may be slightly different after the move. This is because the parameters to the ObjectMove method are pixel values converted to the current form's scaling mode. The conversion from pixels to twips and back doesn't always result in identical values.

Using the OLE Container Control's Pop-up Menus

Each time you draw an OLE container control on a form, the Insert Object dialog box is displayed. Use this dialog box to create a linked or embedded object. If you choose Cancel, no object is created.

At design time, click the OLE container control with the right mouse button to display a pop-up menu. The commands displayed on this pop-up menu depend on the state of the OLE container control as shown in the following table:

Command Enabled in pop-up menu when
Insert Object Always enabled.
Paste Special Clipboard object contains a valid object.
Delete Embedded Object OLE container control contains an embedded object.
Delete Linked Object OLE container control contains a linked object.
Create Link SourceDoc property is set.
Create Embedded Object Class or SourceDoc property is set.

An OLE container control can contain only one object at a time. You can create a linked or embedded object in several ways:

  • Use the Insert Object or Paste Special dialog boxes (run time or design time).

  • Set the Class property in the Properties window, click the OLE container control with the right mouse button, and then select the appropriate command (design time only).

  • Use the appropriate method of the OLE container control.

Finding Class Names

You can get a list of the class names available to your application by selecting the Class property in the Properties window and clicking the Properties button.

Note   The Insert Object dialog box doesn't display a list of class names. This dialog box displays user-friendly names for each class of object, which are generally longer and more easily understood.

Show:
© 2014 Microsoft