Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you display a count of items CHECKED in a LISTVIEW

Status
Not open for further replies.

talenx

Programmer
Aug 7, 2001
157
US
Hello all,
i have a problem...
i can't seem to find any information on how to get a LISTVIEW control to return a record count for items that are CHECKED.
kind of like the listitems.count method, but with only those that have a the CHECKED option = true

look forward to hearung from someone.
thanks
talenx
 
Private Sub Command1_Click()

MsgBox ListViewCheckCount(Form1.ListView1) & " Items Checked", vbOKOnly + vbInformation, "WHO DA MAN!"

End Sub

Public Function ListViewCheckCount(ByRef oListView As ListView) As Long
Dim oListItem As ListItem
Dim lCount As Long

For Each oListItem In oListView.ListItems
lCount = IIf(oListItem.Checked, lCount + 1, lCount)
Next

ListViewCheckCount = lCount

End Function

 
thank you so very much.... i think i spent over 3 days looking onthe net for something that would work.

by the way would you by chance know how to select ALL records in a LISTVIEW control?


thanks again,
talenx
 
Same basic loop with....

oListItem.Checked = true

in place of the

lCount = IIf(oListItem.Checked, lCount + 1, lCount)

statement would check every item in the list.

oListItem.Selected = True

would select (highlight) every item in the list
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top