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. .NET (Core and Framework)
  4. datagridview

datagridview

Scheduled Pinned Locked Moved .NET (Core and Framework)
tutorial
3 Posts 3 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.
  • A Offline
    A Offline
    akr_045
    wrote on last edited by
    #1

    how to perform calculations in datagridview columns (adding two columns and result in new column) can any one suggest me any site thanks in advance

    H J 2 Replies Last reply
    0
    • A akr_045

      how to perform calculations in datagridview columns (adding two columns and result in new column) can any one suggest me any site thanks in advance

      H Offline
      H Offline
      Hypermommy
      wrote on last edited by
      #2

      Some of the gurus on here will probably have a better idea for this but this is what I would try: Dim myCol As New DataGridViewColumn ' I think this is the type. My code was an image column myCol.Name = "colname" dgvMyGrid.Columns.Insert(1, myCol) Then you'll need to access the values of the numbers you need to add and the column where the result should go. I do most of my processing in my OnCellFormatting event. And in there, I access the values of the current row's items with something like this: (sender.Rows(e.RowIndex).Cells(14).Value Of course, you'll need to know your column's number. And don't forget to account for the one you entered. Hope this helps.

      Denise "Hypermommy" Duggan

      1 Reply Last reply
      0
      • A akr_045

        how to perform calculations in datagridview columns (adding two columns and result in new column) can any one suggest me any site thanks in advance

        J Offline
        J Offline
        Jack Vanderhorst
        wrote on last edited by
        #3

        If your DataGridView is bound to a DataTable then this may be what you're looking for: http://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression.aspx[^] I love these columns, they're smokin' fast :)

        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