Hi, need help, how can i code to get the total of that numbers in my lisview, see image below mark with red. I want to display the sum in text box.
http://i10.photobucket.com/albums/a1...d/listview.jpg
Thanks in advance!
Printable View
Hi, need help, how can i code to get the total of that numbers in my lisview, see image below mark with red. I want to display the sum in text box.
http://i10.photobucket.com/albums/a1...d/listview.jpg
Thanks in advance!
Hi, I manage to work this by this codes
VB Code Code:
Sub GetSumTotal() Dim sum As Double Dim x As Integer sum = 0 For x = 1 To lvFilter.ListItems.count sum = sum + lvFilter.ListItems.Item(x).SubItems(16) Next Text1.Text = sum End Sub
My problem now is when the one of the Row in that Column is become "NULL" no value or records it show an error "Type MisMatch" and will no continue to calculate the next records..
Try replacing this line
sum = sum + lvFilter.ListItems.Item(x).SubItems(16)
with this
sum = sum + Val(lvFilter.ListItems.Item(x).SubItems(16))
thanks for that reply sir Lavolpe
my codes work now with no errors. Resolved now.