Results 1 to 3 of 3

Thread: [RESOLVED] vb.net 2012 - Datagridview - Add summary rows

  1. #1

    Thread Starter
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Resolved [RESOLVED] vb.net 2012 - Datagridview - Add summary rows

    Heres my issue... my wifes website lets you order flowers. After the order is submitted, it will show on a special page for her. I am creating a PointOfSale system that will pull this data right into the app and display there instead of needing to keep a webpage open. My problem is trying to re-create the display of this.

    Its a simple table online


    you click the button in the first column and it shows you the order (for printing)


    Now, I have the DataGridView loading the data, and if you click a row it gets the order number.. fine.. i have even made it look similar.

    Question 1 (not important): Can I add a button in the first column? like shown or will it take over the first column (so its filled) - and can i add a clickable image (the map)

    Question 2 (more important): How can i add the summary rows!?
    This is really needed... at each change in the date, a summary total needs to be shown. Can i do this?

    Should I do this unbound so i can control each row? or.. should i use a listview?


    Thanks!
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: vb.net 2012 - Datagridview - Add summary rows

    Erm ... if the web version works why don't you just replicate it at local level and show it in a webbrowser control? Any additional processing you may need can be done behind the scenes.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  3. #3

    Thread Starter
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: vb.net 2012 - Datagridview - Add summary rows

    i dont want to convert her machine to run it locally (PHP etc)...
    (and thats cheating!! lol)

    I really wanted to have it fully contained in the app.... and I have found the solution!!

    it seems i can add rows to the dataset/table after!!

    Code:
    Dim DT As Date = FormatDateTime(DGV1.Rows(0).Cells(1).Value, DateFormat.ShortDate)
            Dim SUM As Decimal = 0
            Dim RC As Integer = DGV1.Rows.Count - 1
            Dim DR As DataRow
            Dim X As Integer
            Do While X <= RC
                If DT = FormatDateTime(DGV1.Rows(X).Cells(1).Value, DateFormat.ShortDate) Then
                    SUM = SUM + DGV1.Rows(X).Cells(10).Value
                Else
    
    
                    DR = DS.Tables(0).NewRow
                    DR.Item(10) = SUM
                    DS.Tables(0).Rows.InsertAt(DR, X)
                    X = X + 1
                    RC = RC + 1
                    SUM = DGV1.Rows(X).Cells(10).Value
                    DT = FormatDateTime(DGV1.Rows(X).Cells(1).Value, DateFormat.ShortDate)
    
    
                End If
                X = X + 1
    
            Loop
            DR = DS.Tables(0).NewRow
            DR.Item(10) = SUM
            DS.Tables(0).Rows.InsertAt(DR, RC + 1)
            DGV1.Refresh()
    Last edited by Static; May 6th, 2013 at 01:28 PM. Reason: code had an issue with row counts... fixed
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width