
Need Better Approach or Third Party Control for Drag/Drop
Using the sub below, I can trap a couple of things:
1) In the case of an email dragged from Outlook and dropped onto the
control, I can trap what appears to be a binary string containing the
description of an email that I would imagine I can feed to an Outlook object
somehow.
2) In the case of a file from an Explorer window, I can trap a file name.
I am wondering two things:
1) Typically, does one have to trap the data from the drag and drop, analyze
it to find out what type of data it is, and then act on that knowledge, or
does anyone know of third party controls/code that might handle typical drag
and drop data?
2) in the case of files, the Data object does not appear to have a method or
property to tell me how many files have been dragged/dropped. Do I have to
trap error 9 to find out the index is out of bounds and that I am done
retrieving files?
Code below.
Thanks,
Michael
Private Sub ListView1_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As
Long, Button As Integer, Shift As Integer, x As Single, y As Single)
Dim myText As String
Dim myText2 As String
If Data.GetFormat(vbCFText) Then
myText = Data.GetData(vbCFText)
End If
If Data.GetFormat(vbCFFiles) Then
myText = Data.Files(1)
myText2 = Data.Files(2)
End If
End Sub