PDA

Click to See Complete Forum and Search --> : Drag & Drop with List View


AM LOPEZ
Dec 15th, 1999, 01:46 AM
Hi everybody!!!

Does anybody know how can i made drag & drop with list view? I have problems to select an item while begin the drag function.

Thanks in advance!!!
I appreciate your help.

------------------
Angel Maldonado López.
Programmer
amaldonado@hotmail.com

Aaron Young
Dec 15th, 1999, 02:36 AM
Add a Listbox and ListView Control to a Form, then Paste this quick Example I have put together..

Private Sub Form_Load()
Dim I As Integer
ListView1.View = lvwList
ListView1.MultiSelect = True
ListView1.DragIcon = LoadPicture("..\Common\Graphics\Icons\DragDrop\Drag3pg.ico")
For I = 1 To 100
ListView1.ListItems.Add , , "Item " & I
Next
End Sub

Private Sub List1_DragDrop(Source As Control, x As Single, y As Single)
Dim I As Integer
If TypeName(Source) <> "ListView" Then Exit Sub
With Source
For I = 1 To .ListItems.Count
If .ListItems(I).Selected Then List1.AddItem .ListItems(I)
Next
End With
End Sub

Private Sub ListView1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then
ListView1.Drag vbBeginDrag
Else
ListView1.Drag vbEndDrag
End If
End Sub



------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net

AM LOPEZ
Dec 15th, 1999, 03:02 AM
Yeah!!!
It works perfect...
Thank you very much Aaron, you have saved my program...
Thanks again...

------------------
Angel Maldonado López.
Programmer
amaldonado@hotmail.com