You can do this, but it will not be automatic. That is, you will have to calculate the subtotals and totals yourself and add them to the ListView.
For subtotals, you can either:
1) Enable footers for the groups and put the subtotals there. The drawback to this is that the columns won't align.
2) Add the subtotal to the group as the last item.
For the overall Total, you will need to add a group at the bottom of the ListView, name it Total and put the total there.
I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson
I find the solution
' Add a group with totals
Dim TotalSum, TotalSum1 As Double
Dim TempDbl As Double
TotalSum = 0
TotalSum1 = 0
For Each strmyGroupname In ListView1.Items
If Double.TryParse(strmyGroupname.SubItems(7).Text, TempDbl) Then TotalSum += TempDbl
If Double.TryParse(strmyGroupname.SubItems(8).Text, TempDbl) Then TotalSum1 += TempDbl
Next
Dim gp As ListViewGroup
gp = New ListViewGroup("total", "total")
ListView1.Groups.Add(gp)
Dim Item1 As New ListViewItem
Item1 = ListView1.Items.Add("total:", 0)
Item1.SubItems.Add("")
Item1.SubItems.Add("")
Item1.SubItems.Add("")
Item1.SubItems.Add("")
Item1.SubItems.Add("")
Item1.SubItems.Add("")
Item1.SubItems.Add(TotalSum)
Item1.SubItems.Add(TotalSum1)
Item1.Group = gp
ListView1.Update()
ListView1.EndUpdate()
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.