Visual Basic Reference

Visual Studio 6.0

OLEDragMode Property

See Also    Example    Applies To

Returns or sets whether the component or the programmer handles an OLE drag/drop operation.


object.OLEDragMode = mode

The OLEDragMode property syntax has these parts:

Part Description
Object An object expression that evaluates to an object in the Applies To list.
Mode An integer which specifies the method with which an component handles OLE drag/drop operations, as described in Settings.


The settings for mode are:

Constant Value Description
VbOLEDragManual 0 (Default) Manual. The programmer handles all OLE drag/drop operations.
VbOLEDragAutomatic 1 Automatic. The component handles all OLE drag/drop operations.


When OLEDragMode is set to Manual, you must call the OLEDrag method to start dragging, which then triggers the OLEStartDrag event.

When OLEDragMode is set to Automatic, the source component fills the DataObject object with the data it contains and sets the effects parameter before initiating the OLEStartDrag event (as well as the OLESetData and other source-level OLE drag/drop events) when the user attempts to drag out of the control. This gives you control over the drag/drop operation and allows you to intercede by adding other formats, or by overriding or disabling the automatic data and formats using the Clear or SetData methods.

If the sources OLEDragMode property is set to Automatic, and no data is loaded in the OLEStartDrag event, or aftereffects is set to 0, then the OLE drag/drop operation does not occur.

Note   If the DragMode property of a control is set to Automatic, the setting of OLEDragMode is ignored, because regular Visual Basic drag and drop events take precedence.