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. DataGridView Control .NET 2.0

DataGridView Control .NET 2.0

Scheduled Pinned Locked Moved C#
csharptutorial
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.
  • U Offline
    U Offline
    usernamed
    wrote on last edited by
    #1

    Hi all, I'm really struggling to do something very simple using a DataGridView control. I'm setting the DataGridView DataSource to an existing DataSet. All the data is displayed fine. I now want to select a range of cells using the DataGridView, and when I click a button, have the selected cells copied to a new (previously empty) dataset. I just can't figure out how to get the data I've selected in the DataGridView control into the new dataset. By putting a watch on the DataGridView control, I can see the list of items contained in the control, but they're all non-public so I have no way of getting at them programmatically. Any assistance would be very much appreciated.

    H A 2 Replies Last reply
    0
    • U usernamed

      Hi all, I'm really struggling to do something very simple using a DataGridView control. I'm setting the DataGridView DataSource to an existing DataSet. All the data is displayed fine. I now want to select a range of cells using the DataGridView, and when I click a button, have the selected cells copied to a new (previously empty) dataset. I just can't figure out how to get the data I've selected in the DataGridView control into the new dataset. By putting a watch on the DataGridView control, I can see the list of items contained in the control, but they're all non-public so I have no way of getting at them programmatically. Any assistance would be very much appreciated.

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

      I don't know if I have understood the question right but you can access the cells with [code] dataGridView1.Rows[0].Cells[1].Value; [\code] hope this helps

      1 Reply Last reply
      0
      • U usernamed

        Hi all, I'm really struggling to do something very simple using a DataGridView control. I'm setting the DataGridView DataSource to an existing DataSet. All the data is displayed fine. I now want to select a range of cells using the DataGridView, and when I click a button, have the selected cells copied to a new (previously empty) dataset. I just can't figure out how to get the data I've selected in the DataGridView control into the new dataset. By putting a watch on the DataGridView control, I can see the list of items contained in the control, but they're all non-public so I have no way of getting at them programmatically. Any assistance would be very much appreciated.

        A Offline
        A Offline
        albCode
        wrote on last edited by
        #3

        if u are looking for this on selectedindexchanged of gridview1 write code below this.textbox1.text = GridView1.SelectedRow.Cells[1].Text

        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