Compute the sum of Listview Column in Visual Basic 6

Download
Download is available until [expire_date]
  • Version
  • Download 867
  • File Size 21.32 KB
  • File Count 1
  • Create Date April 27, 2016
  • Last Updated April 27, 2016

Compute the sum of Listview Column in Visual Basic 6

Compute the sum of Listview Column in Visual Basic 6

Here is the sample program in Visual Basic 6 that will compute the sum in listview column.

It has actually a database in which the records are stored, and then the system will populate the listview with the records from database and computes the sum of a certain column in the listview.

Another solution is to use the sql sum function that computes the sum of a certain field in your database but it is only applicable if your program has a database otherwise you can use this codes of this program to compute the sum of a column in listview control.

Source code:

Function ComputeTotal()
Dim a As Integer, b As Integer, myTotal As Currency
 a = lstCash.ListItems.Count
For b = 1 To a
myTotal = Val(myTotal) + CCur(lstCash.ListItems(b).SubItems(2))
Next
lblTotal.Caption = Format(myTotal, "##,##0.00")
End Function
, , , , ,

Post navigation

2 thoughts on “Compute the sum of Listview Column in Visual Basic 6

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.