OLEDragMode Property (ActiveX Controls)

       

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

Syntax

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.

Settings

The settings for mode are:

Constant Value Description
vbOLEDragManual 0 Manual. The programmer handles all OLE drag/drop operations.
vbOLEDragAutomatic 1 Automatic. The component handles all OLE drag/drop operations.

Remarks

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 source’s 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.