Here's an Example I've put together for you:
Code:
Private Sub Form_Load()
Dim iIndex As Integer
List1.DragMode = vbManual
List2.DragMode = vbManual
List1.DragIcon = LoadPicture("..\Common\Graphics\Icons\DragDrop\Drag1pg.ico")
List2.DragIcon = LoadPicture("..\Common\Graphics\Icons\DragDrop\Drag1pg.ico")
For iIndex = 1 To 10
List1.AddItem "Item " & Right$("00" & iIndex, 2)
Next
End Sub
Private Sub List1_DragDrop(Source As Control, X As Single, Y As Single)
If TypeOf Source Is ListBox Then
If Source.Name = "List1" Then Exit Sub
List1.AddItem Source
Source.RemoveItem Source.ListIndex
End If
End Sub
Private Sub List1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If List1.ListIndex < 0 Then Exit Sub
If Button = vbLeftButton Then List1.Drag vbBeginDrag
End Sub
Private Sub List1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then List1.Drag vbEndDrag
End Sub
Private Sub List2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If List2.ListIndex < 0 Then Exit Sub
If Button = vbLeftButton Then List2.Drag vbBeginDrag
End Sub
Private Sub List2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then List2.Drag vbEndDrag
End Sub
Private Sub List2_DragDrop(Source As Control, X As Single, Y As Single)
If TypeOf Source Is ListBox Then
If Source.Name = "List2" Then Exit Sub
List2.AddItem Source
Source.RemoveItem Source.ListIndex
End If
End Sub
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
Certified AllExperts Expert