-
Hi Guys,
I have a listview control and need to drag more than one item to another listview control. The problem I have is that I can only get the Data Object to pick up the last selected item, my code is listed below is there anyway to make the data object an array which can hold the data I want to transfer ?
Dim iItem As ListItem
For Each iItem In lvItems.ListItems
If iItem.Selected = True Then
Data.SetData iItem.text, vbCFText
End If
Next
AllowedEffects = vbDropEffectMove
-
Your loop would constantly replace the item in the Data object (which I'm not familiar with, though), each time it finds a selected item, thus giving you only the last item.
Do you use the items in the data object for anything but adding items to the listbox? Otherwise, you could just use an array of strings. It would probably be faster. To dim an array, this is how you do:
Dim itmItem() as AnyDataType
Then you use the Redim command to set the dimensions:
ReDim itmItem(100)
This would give the array the dimensions from 0-100, but all data in it would be lost
ReDim Preserve itmItem(100)
This would als give the array the dimensions from 0-100, but all data that was in it before the ReDim would still be there.
Hope this helps... If not drop me a mail and I'll send you some code.
//Anders