Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

drag and drop from desktop

Status
Not open for further replies.

InactiveX

Programmer
Jan 19, 2003
2
ZA
How do I "enable" drag and drop items from DEsktop or Floppy or whatever folder to a DirListBox? any sample codes are welcome.

Thanks
randomx@angelfire.com
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top