-
I've got a listview in report mode (it's a small table, really), and I want the user to be able to change the order of the rows. They should be allowed to click on row 5, drag it up a ways, and drop it between rows 1 and 2 (those are arbitrary numbers). All I want is to allow dragdrop support to the report mode of the listview, but it's eluding me.
Thanks in advance,
bob
-
Bob
this isn't quite a drag and drop but clicking an item selects it and then clicking another item places the first item below the second one
does that make sense?
Code:
Option Explicit
Dim TheItem As ListItem
Dim TheItemIndex As Integer
Private Sub Form_Load()
Dim itmx As ListItem
Dim i As Integer
For i = 0 To 6
Set itmx = ListView1.ListItems.Add(, , "Item " & i)
Next i
End Sub
Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim itmx As ListItem
If TheItemIndex = 0 Then
TheItemIndex = Item.Index
Set TheItem = Item
ListView1.MousePointer = ccCross'change this for an icon
Else
'already set
i = Item.Index
ListView1.ListItems.Remove TheItemIndex
Set itmx = ListView1.ListItems.Add(i + 1)
itmx = TheItem
ListView1.MousePointer = ccDefault
TheItemIndex = 0
End If
End Sub