' 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
' 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
For J = 1 To .Nodes.count
.Nodes(J).Checked = True
.Nodes(J).Selected = True
.Nodes(J).Expanded = True
next
For Each lstTest In ListView1.ListItems
If lstTest.Checked Then
...
...
End If
Next
Private Sub Command2_Click()
Dim lstTest As ListItemFor Each lstTest In ListView1.ListItems
lstTest.Checked = True
Next
End Sub
' 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
我要对checkbox项进行操作to:: yangzhaoyu(老妖) .....如何引用被选中那几行,我要知道那些行数
For Each lstTest In ListView1.ListItems
If lstTest.Checked Then
Debug.Print lstTest.Index 'REPORT列表中的行号
End If
Next