I have a listview that I have set to have checkboxes. I need to see if a user has ticked any of the checkboxes.. What is the code to do this?
Printable View
I have a listview that I have set to have checkboxes. I need to see if a user has ticked any of the checkboxes.. What is the code to do this?
Use the Checked property of a ListView itemBest regardsVB Code:
Dim itm As ListItem For Each itm In ListView1.ListItems If itm.Checked = True Then Debug.Print itm.Text & " is checked" End If Next
VB Code:
Dim i As Long For i = ListView1.ListItems.Count To 0 Step -1 If Listview1.SelectedItem.Selected(i) = True Then Exit For 'if just one item is checked, then it stops Else 'it went through the entire ListView and didn't find anything selected End If Next
Hmmm...Joacim types faster than I do
Well, the selected property can be False even if you have checked one item.
To control the check boxes go with the Checked property.