'    Purpose:
'     Author:吴文智
'       Date:2001-1
'Description:要试用本例请在窗体中填加一个ListView和一个按钮
'            然后在代码窗体中粘贴如下代码
'            Good luck!Option ExplicitPrivate Sub Command1_Click()
    Dim ltmEach As ListItem
    
    For Each ltmEach In ListView1.ListItems
        If ltmEach.Selected Then
            '在此处可进行你需要的操作
            MsgBox ltmEach.Text & " 被选中", vbInformation
        End If
    Next
End SubPrivate Sub Form_Load()
    With ListView1
        .MultiSelect = True
        .ListItems.Add , , "第一项"
        .ListItems.Add , , "第二项"
        .ListItems.Add , , "第三项"
        .ListItems.Add , , "第四项"
        .ListItems.Add , , "第五项"
    End With
End Sub

解决方案 »

  1.   

    我是说,如何全选,消除checkbox.及对选中的checkbox某几行操作?
      

  2.   

    这是一段TREEVIEW代码。
    For J = 1 To .Nodes.count
              .Nodes(J).Checked = True
              .Nodes(J).Selected = True
              .Nodes(J).Expanded = True
    next
      

  3.   

    Dim lstTest As ListItem
    For Each lstTest In ListView1.ListItems
        If lstTest.Checked Then
            ...
            ...
            
        End If
    Next
      

  4.   

    Select all
    Private Sub Command2_Click()
    Dim lstTest As ListItemFor Each lstTest In ListView1.ListItems
        lstTest.Checked = True
    Next
    End Sub
      

  5.   

    '    Purpose:
    '     Author:吴文智
    '       Date:2001-1
    'Description:要试用本例请在窗体中填加一个ListView和一个按钮
    '            然后在代码窗体中粘贴如下代码
    '            Good luck!Option ExplicitPrivate Sub Command1_Click()
        Dim ltmEach As ListItem
        
        For Each ltmEach In ListView1.ListItems
            'If ltmEach.Selected Then
            '    MsgBox ltmEach.Text & " 被选中", vbInformation
            'End If
            ltmEach.Selected = True
            '如果全不选取用
            'ltmeach.Selected=False
        Next
    End SubPrivate Sub Form_Load()
        With ListView1
            .MultiSelect = True
            .HideSelection = False
            .ListItems.Add , , "第一项"
            .ListItems.Add , , "第二项"
            .ListItems.Add , , "第三项"
            .ListItems.Add , , "第四项"
            .ListItems.Add , , "第五项"
        End With
    End Sub
      

  6.   

    http://www.csdn.net/expert/topic/366/366254.shtm
      

  7.   

    to:: foolishtiger(吴文智)
    我要对checkbox项进行操作to:: yangzhaoyu(老妖) .....如何引用被选中那几行,我要知道那些行数
      

  8.   

    Dim lstTest As ListItem
    For Each lstTest In ListView1.ListItems
        If lstTest.Checked Then
            Debug.Print lstTest.Index   'REPORT列表中的行号
            
        End If
    Next