Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. how to sum the values of a single windows form datagrid column

how to sum the values of a single windows form datagrid column

Scheduled Pinned Locked Moved C#
csharpwinformstutorial
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    choopie
    wrote on last edited by
    #1

    I would like to know how to loop the values of int of a single column of a datagrid (windows forms) and sum them. C#

    I 1 Reply Last reply
    0
    • C choopie

      I would like to know how to loop the values of int of a single column of a datagrid (windows forms) and sum them. C#

      I Offline
      I Offline
      Itanium
      wrote on last edited by
      #2

      Hope that this will help.:) CurrencyManager cm = (CurrencyManager)grid.BindingContext[grid.DataSource,grid.DataMember]; int numRows = cm.Count ; DataView dv = (DataView)cm.List ; string cols=string.Empty ; for(int i = 0 ; i < cm.Count ; i++) { //get sum here using dv[i][ColumnName]; }

      sorry for my bad English.

      C 1 Reply Last reply
      0
      • I Itanium

        Hope that this will help.:) CurrencyManager cm = (CurrencyManager)grid.BindingContext[grid.DataSource,grid.DataMember]; int numRows = cm.Count ; DataView dv = (DataView)cm.List ; string cols=string.Empty ; for(int i = 0 ; i < cm.Count ; i++) { //get sum here using dv[i][ColumnName]; }

        sorry for my bad English.

        C Offline
        C Offline
        choopie
        wrote on last edited by
        #3

        I've managed to do it myself but anyway thanks very much :) P.S. sorry for my English too. choopie

        I 1 Reply Last reply
        0
        • C choopie

          I've managed to do it myself but anyway thanks very much :) P.S. sorry for my English too. choopie

          I Offline
          I Offline
          Itanium
          wrote on last edited by
          #4

          You are welcome. :)

          sorry for my bad English.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups