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