Visual Basic Upgrade Companion. VB6 Converter for .NET & Web.

.NET7 supportDownload Now

Cloud Application Migration Tools Transform Desktop Applications

ASP.NET Web Forms

The best available tools to perform code migrations from a source database or Spark application to Snowflake.

Spark Scala
Spark Python
SQL Server

Data Solutions
The premier productivity workbench designed and optimized for teams using Snowflake.

Translation with SnowConvert
Edit, Debug & Deploy
Automated Test Case Generation
Metadata Analysis
Source Code Management

Get Started
There are countless ways to take advantage of BlackDiamond Studio and SnowConvert.

Migration and Other Snowflake Services
Get Up and Running with Snowpark
Using the SnowConvert Trial
Build a Cross-Platform Object Inventory

Monetize Your Data

Time to Mobilize
Free Assessment Tool

VB6 Drag and Drop Overview

1. VB6 Drag and Drop Overview

Drag and drop is actually the same as copy & paste using the mouse instead of the keyboard. In both cases you have a source control (where you are cutting or copying from) and a target control (where you are pasting to). During either operation, a copy of the data is maintained in memory. Cut and paste uses the Clipboard; drag and drop uses a DataObject object, which is in essence a private clipboard.

VB6 supported several drag and drop types: Standard and OLE drag and drop with manual and automatic modes for both types.

1.1. Standard Drag and Drop

Data is passed by using the source control as a drag and drop parameter. The drag operation sets the source control in drag and drop mode. DragOver and DragDrop event handlers in the target control receive the source control so they can obtain the data to be copied or moved from the source control itself.

1.2. OLE Drag and Drop

Data is passed by using the source control as a drag and drop parameter. The data to be copied or moved is set at the beginning of the drag and drop operation inside the OLEStartDrag event handler or by demand by the OLESetData event handler. The OLEDragOver and OLEDragDrop event handlers received the data in a DataObject parameter.

1.3. .NET drag and drop

Drag and Drop in .NET is very similar to VB6 manual OLE drag and drop. The concept and functionality is the same but the names and sequences of events are different.

Handling of the DragOver event is very different in .NET. VB6 provided one handler with the action specified by a state parameter. In .NET the handling is now realized by three different event handlers, one handler for each possible DragOver “states”: drag enter, drag over and drag leave.

Programming of the drag and drop feedback to the user has changed as well. In VB6, the visual notification of allowed drag and drop operations had to be programmed in the DragOver event, where the mouse icon could be changed to another to indicate that the control allows drag and drop operations. The code in the DragDrop event was the one that managed what to do with the data dropped into the control. In .NET, the controls that allow drag and drop events need to have that feature enabled first. The feature is enabled by setting the AllowDrop property of the control to true. Also, the types of allowed drag and drop operations must be specified by setting a DragDropEffect value in the drag over or drag enter event handlers.

.NET now handles automatically the changes in mouse icons during drag and drop operations. If the programmer desires to handle mouse pointer icons manually, the procedure for doing it is somewhat different than in VB6. In VB6’s standard drag and drop, the mouse pointer changes had to be specified in the event handlers of each one of the target controls. In .NET, handling this functionality can be simplified by handling the mouse pointer changes in the GiveFeedback event handler of the source control.

1.4. Differences between VB6 standard drag and drop and .NET drag and drop.

Functionality Visual Basic 6.0 .NET
Start drag method object.Drag object.DoDragDrop
Drag drop event handler object_DragDrop object_DragDrop
Drag Over event handler object_DragOver




Drag Over states state parameter of DragOver event handler




Drag icon property object.DragIcon in each control’s DragOver event handler

1. GiveFeedbackEventArgs parameter in drag over event handler (auto)

2. object.Cursor property of target control (custom)

1.5. Differences between VB6 OLE drag and drop and .NET drag and drop.

Functionality Visual Basic 6.0 .NET
Start drag method object.OLEDrag object.DoDragDrop
Start drag event handler object_OLEStartDrag N/A (use DoDragDrop method)
Drag Drop event handler object_OLEDragDrop object_DragDrop
Drag Over event handler object_OLEDragOver




Feedback event handler object_OLEGiveFeedback object_GiveFeedback
Drag complete handler object_OLECompleteDrag object_DragDrop (target)
Set Data event handler object_OLESetData N/A ( use DragEventArgs Data.SetData method in DragDrop event handler)

See also:

Talk To An Engineer