'Drag and Drop within a application

Suppose you have a listbox with some elements and want to drag&drop a selected one into 
a textbox. I know there are easier ways to do this but it's just for making the point.

Make a form with a textbox (text1) and a listbox (list1). Fill the listbox with some items... 
Make a label (label1). Set it invisible = False

Put the next code at the appropiate places:

Sub List1_MouseDown (Button 

as

Integer, Shift

as

Integer, X

as

Single, Y

as

Single) Dim DY DY = TextHeight("A") Label1.Move list1.Left, list1.Top + Y - DY / 2, list1.Width, DY Label1.Drag End Sub Sub List1_DragOver (Source

as

Control, X

as

Single, Y

as

Single,

state

as

Integer) If

state

= 0 Then Source.MousePointer = 12 If

state

= 1 Then Source.MousePointer = 0 End Sub Sub Form_DragOver (Source

as

Control, X

as

Single, Y

as

Single,

state

as

Integer) If

state

= 0 Then Source.MousePointer = 12 If

state

= 1 Then Source.MousePointer = 0 End Sub Sub Text1_DragDrop (Index

as

Integer, Source

as

Control, X

as

Single, Y

as

Single) text1.text = list1 End Sub
Return