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 data transfer from one form to other form

datagridview data transfer from one form to other form

Scheduled Pinned Locked Moved C#
question
4 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.
  • S Offline
    S Offline
    sher ali
    wrote on last edited by
    #1

    hi i am using to form in my application each form have a datagridview i want to transfer all the rows of one datagridview to other form datagridview how?

    P 1 Reply Last reply
    0
    • S sher ali

      hi i am using to form in my application each form have a datagridview i want to transfer all the rows of one datagridview to other form datagridview how?

      P Offline
      P Offline
      Praveen Raghuvanshi
      wrote on last edited by
      #2

      You can bound both the datagridview with the same datasource.

      - Praveen

      V S 2 Replies Last reply
      0
      • P Praveen Raghuvanshi

        You can bound both the datagridview with the same datasource.

        - Praveen

        V Offline
        V Offline
        vineesh v
        wrote on last edited by
        #3

        You can use this method to get the DatagridView DataSource. public Form2(DataGridView dg) { InitializeComponent(); this.dataGridView1.DataSource = (DataTable)dg.DataSource; }

        1 Reply Last reply
        0
        • P Praveen Raghuvanshi

          You can bound both the datagridview with the same datasource.

          - Praveen

          S Offline
          S Offline
          sher ali
          wrote on last edited by
          #4

          i did't bound any datagrid to any datasource but i just added some rows to one datagrid and want to copy it to other form datagrid using the code

          RegistrationForm rg = new RegistrationForm();
          for (int i = 0; i < dataGridView2.Rows.Count-1; i++)
          {
          string[] values = { dataGridView2.Rows[i].Cells ["TestID"].Value.ToString(), dataGridView2.Rows[i].Cells["TestName"].Value.ToString(), dataGridView2.Rows[i].Cells["Charges"].Value.ToString(), dataGridView2.Rows[i].Cells["DeliveryDate"].Value.ToString() };
          RegistrationForm.dataGridView1.Rows.Add(values);
          his.Close();

          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