判断ListView中是否有项被选中,桇何做?ListView2.SelectedItems.Count这样不行。我用的是VB6.0, 请各位前辈指点一下,谢谢

解决方案 »

  1.   

    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
      

  2.   

    for i=0 to listview1.listitems.count-1
        if listview1.listitems(i).selected=true then
             XXXX,如果此行被选中要执行操作。
        end if
    next i
      

  3.   

    首先,你是不是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
    如果没有,那就是老张的代码
      

  4.   

    感谢老张和AisaC , 老张是对的,刚才看NBA了。