Below is the code that I am using to collect files from explorer in a multiple drag and drop operation to a text box located on my VB form.
It works great, but I can't get the icon (draging icon) to change to a custom (one that I created) icon when it hovers over the textbox. I have tried the OLEDragOver event, but it doesn't seem to work.
Does anybody have a simple working example or pointers?
I know this is probably really simple....
Thanks...
'========================================
Private Sub txtFiles_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim i As Long, upper As Long
upper = Data.Files.Count
For i = 1 To upper
'check if the dragged object(s) is a file or directory
If (GetAttr(Data.Files(i))) = vbDirectory Then
MsgBox "Directories cannot be dropped into the editor", vbCritical + vbOKOnly, "Opps..."
Else
'if the the object is not a directory then see if it
'is a valid file.
If Data.GetFormat(vbCFFiles) Then
txtFiles.Text = txtFiles.Text & Data.Files.Item(i) & vbNewLine
End If
End If
Next 'i
Data.Files.Clear 'clear it out for the next run
End Sub
'======================================== Troy Williams B.Eng.
fenris@hotmail.com
It works great, but I can't get the icon (draging icon) to change to a custom (one that I created) icon when it hovers over the textbox. I have tried the OLEDragOver event, but it doesn't seem to work.
Does anybody have a simple working example or pointers?
I know this is probably really simple....
Thanks...
'========================================
Private Sub txtFiles_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim i As Long, upper As Long
upper = Data.Files.Count
For i = 1 To upper
'check if the dragged object(s) is a file or directory
If (GetAttr(Data.Files(i))) = vbDirectory Then
MsgBox "Directories cannot be dropped into the editor", vbCritical + vbOKOnly, "Opps..."
Else
'if the the object is not a directory then see if it
'is a valid file.
If Data.GetFormat(vbCFFiles) Then
txtFiles.Text = txtFiles.Text & Data.Files.Item(i) & vbNewLine
End If
End If
Next 'i
Data.Files.Clear 'clear it out for the next run
End Sub
'======================================== Troy Williams B.Eng.
fenris@hotmail.com