Results 1 to 6 of 6

Thread: Copy content of DataGridView to another DatagridView located on another form.........

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2008
    Posts
    60

    Unhappy Copy content of DataGridView to another DatagridView located on another form.........

    Hi 2 all,


    Here m facing problem while copying all the content of Datagridview to another datagridview located on another form..Please help me put from this, by providing some code snippet....

    Thanks and Regards,
    V'jay

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

    Re: Copy content of DataGridView to another DatagridView located on another form.....

    Maybe you could let us know what problem you're facing so we know what issue it is we're trying to overcome. Where does the data come from in the first place? Is the grid bound or is it populated manually?
    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

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2008
    Posts
    60

    Re: Copy content of DataGridView to another DatagridView located on another form.....

    Quote Originally Posted by jmcilhinney View Post
    Maybe you could let us know what problem you're facing so we know what issue it is we're trying to overcome. Where does the data come from in the first place? Is the grid bound or is it populated manually?
    It is populated manually....

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

    Re: Copy content of DataGridView to another DatagridView located on another form.....

    So what is the code you're using at the moment and what goes wrong when you use it?
    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

  5. #5

    Thread Starter
    Member
    Join Date
    Dec 2008
    Posts
    60

    Re: Copy content of DataGridView to another DatagridView located on another form.....

    Quote Originally Posted by jmcilhinney View Post
    So what is the code you're using at the moment and what goes wrong when you use it?
    till now i am not written any code.....just reply how do i start..

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

    Re: Copy content of DataGridView to another DatagridView located on another form.....

    So you're not actually facing a problem while copying, because you're not actually copying yet.

    To access every row in the grid you can loop through its Rows collection.
    To access every cell in a row you can loop through its Cells collection.
    To access the data in a cell you can get its Value property.

    If you need to transport this data from one form to another then wouldn't it be easier to NOT populate the grid manually? If you have your data in a collection and bind it to the grid then all you need to do is pass that collection to the other form and then bind it to that grid too.
    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