Hi, I am fairly a newbie to vb.net and am developing an inventory control windows application for a client.

I am creating a search form for my application. This search form searches the categorys table and returns the results in a datagrid view. The search bit of it is working, however what i want it to do next is not working!

I have a button on the Search form called "Return Data". Once the search results have been displayed in the datagrid view, the user will then select/highlight the row that they need. They will then click on the "Return Data" button and this button should then return the selected row in the datagrid view and display it in another datagrid view on another form.

I am just finding it extremely difficicult to getting this sorted. I have not got anywhere with it. Any sample code would be most appreciated.

Thanks

For Each r As DataGridViewRow In DataGridView1.SelectedRows
  MsgBox(r.Cells(0).Value)
Next

Im not sure where to put the above code. Will it go in the onClick event of the Return Data button on the Search form?

Any where withing the form class where you want to copy selected rows.