Results 1 to 2 of 2

Thread: copy selected rows to another datagridview

  1. #1

    Thread Starter
    Fanatic Member manhit45's Avatar
    Join Date
    May 2009
    Location
    Ha noi - Viet Nam
    Posts
    826

    copy selected rows to another datagridview

    I have 2 datagridview. I want to copy selected rows of first datagridview to second datagridiview.
    --***----------***-----

    If i help you please rate me.

    Working with Excel * Working with String * Working with Database * Working with array *

    K51 ĐH BÁCH KHOA HÀ NỘI - Khoa CNTT pro.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: copy selected rows to another datagridview

    The first step would be to use a For Each loop to iterate over the SelectedRows collection of the first grid. You may then be able to Clone the current row and add that clone to the second grid, although I've never actually tried that. If that doesn't work you can just Add a new row to the second grid and copy the Value of each cell across from the current row in the loop.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width