3 Replies - 219 Views - Last Post: 02 December 2018 - 10:25 PM Rate Topic: -----

#1 [email protected]   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 82
  • Joined: 16-May 17

How to add sub total row in LISTVIEW1 report

Posted 01 December 2018 - 01:02 AM

I create a project on vb.net 2010 and SQL server 2008r2 I showing a report in listview report am show fine and error free. But now I want to add a sub total column every end of the category. How it is possible please help me sir

Please see the attachment picture

https://ibb.co/tZ86Hvb

https://ibb.co/V22d4Sk

Posted Image

Posted Image

I try many coding, but not work, because i have no more knowledge about this.
And search on google but many example are on Datagridview, but I used Listview
please help me sir.......

This post has been edited by andrewsw: 03 December 2018 - 02:03 AM
Reason for edit:: removed "please help me" fluff from title


Is This A Good Question/Topic? 0
  • +

Replies To: How to add sub total row in LISTVIEW1 report

#2 Sheepings   User is offline

  • Senior Programmer
  • member icon

Reputation: 173
  • View blog
  • Posts: 1,029
  • Joined: 05-December 13

Re: How to add sub total row in LISTVIEW1 report

Posted 01 December 2018 - 06:50 AM

Post the code you tried and we will help you alter it to your liking.
Was This Post Helpful? 0
  • +
  • -

#3 [email protected]   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 82
  • Joined: 16-May 17

Re: How to add sub total row in LISTVIEW1 report

Posted 02 December 2018 - 08:12 PM

View PostSheepings, on 01 December 2018 - 07:20 PM, said:

Post the code you tried and we will help you alter it to your liking.

    Public Sub GetAllSItemStock() 
        With objStock_RPT
            ListView1.Items.Clear()
            .Sdate = txtdtf.Text
            .EDate = txtdtt.Text
            .opnstk2 = cmbOpeningstock.Text
            .natureofstk = cmbNature.Text
            .itmnm = cmbitemnm.Text
            .catnm2 = cmbgrpnm.Text
            .subcatnm2 = cmbsubgrpnm.Text
            .partynm = cmbpartynm.Text
            .hsnstk = cmbHSNwiseStock.Text
            .gststk = cmbGSTWisestock.Text
            .cuzstk = cmbCustomizestock.Text
            .cuzstkQty = txtcusqty.Text
            dt1 = .GetAllItemStock() 'change

            For i As Integer = 0 To dt1.Rows.Count - 1
                Dim dr As DataRow = dt1.Rows(i)
                Dim listitem As New ListViewItem(dr("catnm").ToString())
                listitem.SubItems.Add(dr("itemnm").ToString())
                listitem.SubItems.Add(dr("opnstk").ToString())
                listitem.SubItems.Add(dr("untnm").ToString())
                listitem.SubItems.Add(dr("purchaseQty").ToString())
                listitem.SubItems.Add(dr("SaleQty").ToString())
                listitem.SubItems.Add(dr("Converted").ToString())
                listitem.SubItems.Add(dr("Production").ToString())
                listitem.SubItems.Add(dr("Purchase_Return_QTY").ToString())
                listitem.SubItems.Add(dr("Sale_Return_QTY").ToString())
                listitem.SubItems.Add(dr("Closing_Stock").ToString())
                listitem.SubItems.Add(dr("lastPurchaseDate").ToString())
                listitem.SubItems.Add(dr("lastSaleDate").ToString())
                listitem.SubItems.Add(dr("StkGSTRate").ToString())
                listitem.SubItems.Add(dr("brate").ToString())
                listitem.SubItems.Add(dr("Amount").ToString())
                listitem.SubItems.Add(dr("hsnshortnm").ToString())
                ListView1.Items.Add(listitem)
            Next
        End With

    End Sub


i used this code for show details in listview. i want subtotal category wise and end of the report sum of all sub total (grand total).
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14693
  • View blog
  • Posts: 58,724
  • Joined: 12-June 08

Re: How to add sub total row in LISTVIEW1 report

Posted 02 December 2018 - 10:25 PM

I hope you are not planning on printing that. MS has 'local reports' via Report Viewer that are better suited.

I don't know what your collections are, but you can certainly add rows that are sums of what ever other rows and .add them to the listview items collection.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1