Results 1 to 2 of 2

Thread: datagridview - sum

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2007
    Posts
    694

    datagridview - sum

    I have populated a datagridview control with decimal numbers as below.
    It also has a last row as Total.

    How do I sum the figures in each column to place into the appropriate cell for the final row i.e. Total row?
    Thanks

    country column1 column2 column3

    Russia 24,987.524 543,711,654.890 5,554.875
    UK 65,977.324 513,311,254.690 6,654.175
    US 84,987.524 943,711,654.890 3,554.875
    Total

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: datagridview - sum

    You loop through the Rows and add the Value from the appropriate cell to a running total.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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