方法1:
ListView.MultiSelect = True
Dim lstItem As MSComctlLib.ListItem
For Each lstItem In ListView.ListItems
If lstItem.Selected Then
...do yourself
End If
Next
方法2:
Dim nCount As Integer
Dim nIndex As Integer
Dim oitem As ListItem
With lvProc
nCount = .ListItems.Count
For nIndex = nCount To 1 Step -1
If .ListItems.Item(nIndex).Checked = True Then
.ListItems.Remove nIndex
End If
Next
End With
其实是一种算法,用于解决循环遍历,且遍历对象产总数要变化.
ListView操作技巧
本文介绍了两种在Visual Basic中处理ListView的方法:一种是通过遍历选定项进行操作,另一种是在遍历过程中移除已选中的项。这两种方法对于实现复杂的ListView交互非常有用。
6493

被折叠的 条评论
为什么被折叠?



