Hi,
Could someone please show me how to drag and drop a file into a ListView Control.
:) Thanks :)
Printable View
Hi,
Could someone please show me how to drag and drop a file into a ListView Control.
:) Thanks :)
Funny! I just didn't have to modify anything in the code. Here you go:
set the listbox props:
oledragmode=1
oledropmode=1
and the code:
--------------------------------------
Private Sub Lista_OLEDragDrop(data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
If data.GetFormat(15) Then
For n = 1 To data.Files.Count
lista.AddItem data.Files(n)
Next n
Else
End If
End Sub
--------------------------------------
Hope this will help.
After edit: Oh no! I knew it. There was something I just had to modify.
[Edited by kedaman on 03-21-2000 at 08:00 AM]
kedaman that code is for a list box NOT a list view!
setting the correct icon is a bit trickier though!Code:Private Sub ListView1_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
Dim itmX As ListItem
Dim i As Integer
If Data.GetFormat(15) Then
For i = 1 To Data.Files.Count
Set itmX = ListView1.ListItems.Add(, , Data.Files(i))
Next i
End If
End Sub
I'll have to have a think about that one;)