Thanks bingie. You are on the right track, but the code needs to add up checked Totals.
My Listview has 3 columns, The 3rd column contains dollar amounts. As each record is checked, or unchecked, Label1 needs to show the running total.
Item Comments Total
1 Text comments $325.00
18 More Text comments $125.00
Grand Total $450.00
Thanks.
Main Topics
Browse All Topics





by: bingiePosted on 2007-01-09 at 17:47:10ID: 18280834
Add a listview and a label to your form and paste the following:
Private Sub Form_Load()
Dim i As Integer
With ListView1
.View = lvwReport
.Checkboxes = True
.ColumnHeaders.Add , , "Item x", .Width
For i = 0 To 10
.ListItems.Add , , "Item " & i
Next
End With
End Sub
Private Sub ListView1_ItemCheck(ByVal Item As MSComctlLib.ListItem)
'Use this event to trap when an item is checked/unchecked
Dim cnt As Integer
With ListView1
For i = 0 To 10
If .ListItems.Item(i + 1).Checked Then cnt = cnt + 1
Next
End With
Label1.Caption = cnt
End Sub