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. Datagrid to arraylist

Datagrid to arraylist

Scheduled Pinned Locked Moved C#
regextutorialquestionannouncement
2 Posts 2 Posters 1 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.
  • J Offline
    J Offline
    jeweladdict
    wrote on last edited by
    #1

    There are plenty of articles on how to bind an arraylist to a datagrid, but how exactly does one get the arraylist back out of the datagrid? I have bound an arraylist to the datagrid, and allow users to change all values (decimal, string, checkbox) and would like to update my arraylist to match the changes. I guess there are two approaches, interate through each row of the datagrid, create a new object for my arraylist, and add it to a new arraylist... Or I could just go trhough and compare the objects in arraylist and that of the datagrid and update whatever has changed... Can anyone point me in the right direction as to how to approach this?

    J 1 Reply Last reply
    0
    • J jeweladdict

      There are plenty of articles on how to bind an arraylist to a datagrid, but how exactly does one get the arraylist back out of the datagrid? I have bound an arraylist to the datagrid, and allow users to change all values (decimal, string, checkbox) and would like to update my arraylist to match the changes. I guess there are two approaches, interate through each row of the datagrid, create a new object for my arraylist, and add it to a new arraylist... Or I could just go trhough and compare the objects in arraylist and that of the datagrid and update whatever has changed... Can anyone point me in the right direction as to how to approach this?

      J Offline
      J Offline
      Jay Riggs
      wrote on last edited by
      #2

      I vaguely recall seeing code similar to this: ArrayList list = (ArrayList) yourDataGrid.DataSource;

      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