Hi there,
I am a newbie to Vb.Net with VB6 background. I am using ListView to display rows of data with checkbox to enable user to make selection by ticking in the checkbox. When the form is closed I have a method which will loop thru the ListView to count how many checkbox were ticked. Apparently, the routine counted all the rows instead of just the ticked checkbox.
My sample script attached.
Private Function FCheckBox()
Dim itmx As ListViewItem
Dim lw As ListView = Me.ListSelection
Dim lngPCheckCount as integer = 0
With lw
For Each itmx In .Items
If .CheckedItems(1).Checked = True Then
lngPCheckCount += 1
End If
Next
End With
End Function
I am a newbie to Vb.Net with VB6 background. I am using ListView to display rows of data with checkbox to enable user to make selection by ticking in the checkbox. When the form is closed I have a method which will loop thru the ListView to count how many checkbox were ticked. Apparently, the routine counted all the rows instead of just the ticked checkbox.
My sample script attached.
Private Function FCheckBox()
Dim itmx As ListViewItem
Dim lw As ListView = Me.ListSelection
Dim lngPCheckCount as integer = 0
With lw
For Each itmx In .Items
If .CheckedItems(1).Checked = True Then
lngPCheckCount += 1
End If
Next
End With
End Function