Don't know if you could do that with a DirListBox.
However, with an ordinary list box,
Option Explicit
Private Sub Form_Load()
List1.Enabled = True
List1.OLEDropMode = vbOLEDropManual
End Sub
Private Sub List1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim nFileCount As Integer
Dim i As Integer
If Data.GetFormat(vbCFFiles) Then
nFileCount = Data.Files.Count
For i = 1 To nFileCount
List1.AddItem Data.Files(i)
Next
End If
End Sub
Private Sub List1_OLEDragOver(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single, State As Integer)
If Data.GetFormat(vbCFFiles) Then
Effect = vbDropEffectCopy And Effect
Else
Effect = vbDropEffectNone
End If
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.