关于listview多选问题
我在listview1中没有使用checkbox,而是通过ctrl键多行选择。并想实现拖拽,将所选行放置到listview2中,listview2放置代码如下:
Private Sub ListView2_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
Dim i As Integer
Dim j As Integer
Dim LItem As ListItem
If ListView1.ListItems.Count <> 0 Then
If ListView2.Gridlines = False Then ListView2.Gridlines = True
For j = 1 To ListView1.ListItems.Count
If ListView1.ListItems(j).Checked = True Then
Set LItem = ListView2.ListItems.Add(, , ListView1.SelectedItem.Text)
For i = 1 To 6
LItem.SubItems(i) = ListView1.SelectedItem.ListSubItems(i)
Next i
End If
Next j
End If
End Sub
为什么选中的不是多行,而是鼠标所点的那行??
[解决办法]
If ListView1.ListItems(j).selected= True Then