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

DataGridView

Scheduled Pinned Locked Moved C#
questiontutorial
9 Posts 5 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.
  • I Offline
    I Offline
    Illegal Operation
    wrote on last edited by
    #1

    Hi! I have a question. I have a DataGridView that displays some records and beside it I have another DataGridView. How can I double click on a record in DataGridView1 so that the record appears in DataGridView2? It's basically an assignment function where I double click the records I need and they are displayd in the second gridview. I know that I have to execute the code in the double click event of the datagridview but I have no idea how to add the selected record to datagridview2 Thank you in Advance!!

    Illegal Operation

    C P L V 4 Replies Last reply
    0
    • I Illegal Operation

      Hi! I have a question. I have a DataGridView that displays some records and beside it I have another DataGridView. How can I double click on a record in DataGridView1 so that the record appears in DataGridView2? It's basically an assignment function where I double click the records I need and they are displayd in the second gridview. I know that I have to execute the code in the double click event of the datagridview but I have no idea how to add the selected record to datagridview2 Thank you in Advance!!

      Illegal Operation

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You'd have to read the data from the record, put it into an acceptable data source, like a list, and apply it to the second view.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      1 Reply Last reply
      0
      • I Illegal Operation

        Hi! I have a question. I have a DataGridView that displays some records and beside it I have another DataGridView. How can I double click on a record in DataGridView1 so that the record appears in DataGridView2? It's basically an assignment function where I double click the records I need and they are displayd in the second gridview. I know that I have to execute the code in the double click event of the datagridview but I have no idea how to add the selected record to datagridview2 Thank you in Advance!!

        Illegal Operation

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #3

        Why? What are you trying to accomplish? Are you copying data? Anyway, I very rarely use a DataGridView, they're generally not very appropriate for production applications (they're really only good for making quick-and-dirty prototypes and demoes).

        V 1 Reply Last reply
        0
        • I Illegal Operation

          Hi! I have a question. I have a DataGridView that displays some records and beside it I have another DataGridView. How can I double click on a record in DataGridView1 so that the record appears in DataGridView2? It's basically an assignment function where I double click the records I need and they are displayd in the second gridview. I know that I have to execute the code in the double click event of the datagridview but I have no idea how to add the selected record to datagridview2 Thank you in Advance!!

          Illegal Operation

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Are you using "data bound" grids or "unbound" grids? If you're using "unbound" grids, then retrieve the selected DataGridViewRow(s) and copy them to the second grid. If you're using "bound" grids, you should be using a typed dataset with 2 tables of the same type, and using the methods of the typed tables to retrieve the selected row(s) and adding them to the second table. (see the grid's .SelectedRows and row .Selected properties for starters).

          1 Reply Last reply
          0
          • I Illegal Operation

            Hi! I have a question. I have a DataGridView that displays some records and beside it I have another DataGridView. How can I double click on a record in DataGridView1 so that the record appears in DataGridView2? It's basically an assignment function where I double click the records I need and they are displayd in the second gridview. I know that I have to execute the code in the double click event of the datagridview but I have no idea how to add the selected record to datagridview2 Thank you in Advance!!

            Illegal Operation

            V Offline
            V Offline
            V 0
            wrote on last edited by
            #5

            look into the datagridviews.Rows.Add function. I think it even takes a DataGridViewRow object. extract that object from your first datagridview and your done. hope this helps.

            V.
            Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive

            1 Reply Last reply
            0
            • P PIEBALDconsult

              Why? What are you trying to accomplish? Are you copying data? Anyway, I very rarely use a DataGridView, they're generally not very appropriate for production applications (they're really only good for making quick-and-dirty prototypes and demoes).

              V Offline
              V Offline
              V 0
              wrote on last edited by
              #6

              PIEBALDconsult wrote:

              they're generally not very appropriate for production applications

              It's the first time I here this, why do you find it inappropriate for production applications?

              V.
              Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive

              P 1 Reply Last reply
              0
              • V V 0

                PIEBALDconsult wrote:

                they're generally not very appropriate for production applications

                It's the first time I here this, why do you find it inappropriate for production applications?

                V.
                Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive

                P Offline
                P Offline
                PIEBALDconsult
                wrote on last edited by
                #7

                There's usually a better way to present the data; very few applications (pretty much just spreadsheets) work well as a grid.

                V 1 Reply Last reply
                0
                • P PIEBALDconsult

                  There's usually a better way to present the data; very few applications (pretty much just spreadsheets) work well as a grid.

                  V Offline
                  V Offline
                  V 0
                  wrote on last edited by
                  #8

                  Ok, it's from a functional level, not because the control is 'bad'.

                  V.
                  Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive

                  P 1 Reply Last reply
                  0
                  • V V 0

                    Ok, it's from a functional level, not because the control is 'bad'.

                    V.
                    Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive

                    P Offline
                    P Offline
                    PIEBALDconsult
                    wrote on last edited by
                    #9

                    Right.

                    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