|
-
Jan 3rd, 2017, 03:41 PM
#1
Thread Starter
Lively Member
-
Jan 3rd, 2017, 05:00 PM
#2
Re: Sum of checked list item!
loop through the entire listview, and IF an item is checked, then do your summation.
-
Jan 4th, 2017, 11:23 AM
#3
Re: Sum of checked list item!
Maybe something like this:
Code:
Dim I as Integer, A as Integer
A = 0
For i = 1 To ListView1.listitems.count
if listview1.SelectedItem.Checked = True then
A = A + ListView1.ListItems(i).SubItems(2)
end if
Next
Text5.Text = A
-
Jan 4th, 2017, 12:09 PM
#4
Re: Sum of checked list item!
oops
do this:
Code:
Dim lvwItem As ListItem, A As Integer
For Each lvwItem In ListView1.ListItems
If lvwItem.Checked = True Then
A = A + ListView1.ListItems(1).SubItems(2)
End If
Next lvwItem
Text5.Text = A
-
Jan 4th, 2017, 03:58 PM
#5
Thread Starter
Lively Member
Re: Sum of checked list item!
Dear SamOscarBrown Thank you for this code but it does not work. when i check any item, only the first item will show in text5

I changed the code to
Dim lvwItem As ListItem, A As Integer
For Each lvwItem In ListView1.ListItems()
If lvwItem.Checked = True Then
A = A + ListView1.ListItems(lvwItem).SubItems(2)
End If
Next lvwItem
Text5.Text = A
<<< But still this not work. >>>>
-
Jan 4th, 2017, 06:01 PM
#6
Re: Sum of checked list item!
Mea Culpa---
here:
Code:
Dim i As Integer, A As Integer
For i = 1 To ListView1.ListItems.Count
If ListView1.ListItems(i).Checked = True Then
A = A + ListView1.ListItems(i).SubItems(2)
End If
Next I
Text5.text = A
-
Jan 6th, 2017, 09:46 AM
#7
Thread Starter
Lively Member
Re: Sum of checked list item!
Thank you Dear SamOscarBrown it work perfectly
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|