Private Sub Command1_Click() Dim i, j As Integer For i = 1 To ListView1.ListItems.Count If ListView1.ListItems(i).Selected = True Then j = j + 1 End If Next MsgBox j End Sub
for i=0 to listview1.listitems.count-1 if listview1.listitems(i).selected=true then XXXX,如果此行被选中要执行操作。 end if next i
首先,你是不是listview.checkbox = true了?如果是,那就是: Private Sub Command1_Click() Dim i, j As Integer For i = 1 To ListView1.ListItems.Count If ListView1.ListItems(i).checked= True Then j = j + 1 End If Next MsgBox j End Sub 如果没有,那就是老张的代码
Dim i, j As Integer
For i = 1 To ListView1.ListItems.Count
If ListView1.ListItems(i).Selected = True Then
j = j + 1
End If
Next
MsgBox j
End Sub
if listview1.listitems(i).selected=true then
XXXX,如果此行被选中要执行操作。
end if
next i
Private Sub Command1_Click()
Dim i, j As Integer
For i = 1 To ListView1.ListItems.Count
If ListView1.ListItems(i).checked= True Then
j = j + 1
End If
Next
MsgBox j
End Sub
如果没有,那就是老张的代码