When a listbox's Multiselect property is set to Extended how do you drag multiple items? If you start moving with the mouse button down, you just select more entries.
Printable View
When a listbox's Multiselect property is set to Extended how do you drag multiple items? If you start moving with the mouse button down, you just select more entries.
Try this example I put together using 2 Listboxes.. (Make sure the DragMode is Manual)..
Code:Private Sub Form_Load()
Dim iIndex As Integer
For iIndex = 1 To 10
List1.AddItem "Item " & iIndex
Next
End Sub
Private Sub List1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
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)
List1.Drag vbEndDrag
End Sub
Private Sub List2_DragDrop(Source As Control, X As Single, Y As Single)
Dim iIndex As Integer
If TypeOf Source Is ListBox Then
List2.Clear
For iIndex = 0 To Source.ListCount - 1
If Source.Selected(iIndex) Then List2.AddItem Source.List(iIndex)
Next
End If
End Sub
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
I was trying to duplicate the functionality of explorer, where you could select a bunch of items from a list, let go of the mouse, then mousedown on one of the selected items and they would all be dragged.
Thanks.
Chris