Visual Basic Reference

Visual Studio 6.0

OLECompleteDrag Event

See Also    Example    Applies To

Occurs when a source component is dropped onto a target component, informing the source component that a drag action was either performed or canceled.


Private Sub object_OLECompleteDrag([effect As Long])

The OLECompleteDrag event syntax has these parts:

Part Description
Object An object expression that evaluates to an object in the Applies To list.
Effect A long integer set by the source object identifying the action that has been performed, thus allowing the source to take appropriate action if the component was moved (such as the source deleting data if it is moved from one component to another). The possible values are listed in Settings.


The settings for effect are:

Constant Value Description
VbDropEffectNone 0 Drop target cannot accept the data, or the drop operation was canceled.
VbDropEffectCopy 1 Drop results in a copy of data from the source to the target. The original data is unaltered by the drag operation.
VbDropEffectMove 2 Drop results in data being moved from the drag source to the drop source. The drag source should remove the data from itself after the move.


The OLECompleteDrag event is the final event to be called in an OLE drag/drop operation. This event informs the source component of the action that was performed when the object was dropped onto the target component. The target sets this value through the effect parameter of the OLEDragDrop event. Based on this, the source can then determine the appropriate action it needs to take. For example, if the object was moved into the target (vbDropEffectMove), the source needs to delete the object from itself after the move.

If OLEDragMode is set to Automatic, then Visual Basic handles the default behavior. The event still occurs, however, allowing the user to add to or change the behavior.

Most components support manual OLE drag and drop events, and some support automatic OLE drag and drop events.