Question Multiple rows selection from one datagridview to transfer to another datagridview

raj2010

New member
Joined
Jul 10, 2010
Messages
2
Programming Experience
Beginner
In VB.NET 2008 I've two forms 1 & 2 containing two datagridviews connected to two data source 'ACCESS 2007 tables' Now I want to select multiple rows from one datagridview (form1) & transferring these to another empty datagridview (form2) with a button_click. Any solution pl.
 
This second DataGridView is also bound to a DataTable, right? If so then you must add the new data to that bound DataTable. Do the two DataTables have the same schema? Are you intending to save the data from the second grid back to the database? Is the second from already open? As you can see, to give a proper solution we often need more information than just the immediate problem, which is why you should always give a FULL and CLEAR description of the problem.
 
Re:

Here is the details:
Ist Form:-

Public Class WOOD

Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'RTP_FINALDataSet._8WOOD_WORK' table. You can move, or remove it, as needed.
Me._8WOOD_WORKTableAdapter.Fill(Me.RTP_FINALDataSet._8WOOD_WORK)

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

______CODE?____________________________
End Sub

Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick

End Sub
End Class

2nd Form:-

Public Class G_SCH

Private Sub G_SCH_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'RTP_FINALDataSet2.EMPTY_G_SCH' table. You can move, or remove it, as needed.
Me.EMPTY_G_SCHTableAdapter.Fill(Me.RTP_FINALDataSet2.EMPTY_G_SCH)

End Sub

Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick

End Sub
End Class

Now I want to select few rows from table WOOD (master data base) & copy to table G_SCH (empty data table), to save as new data table for further use. Both the tables have same fields & properties.
 
Last edited:
not the most classiest of ideas but you could iterate through one gridview row(x).cells(y) and load the data into a variable then access the other datagrid and use rows(x).cells(y) and set the value or text property to that of the variable.
 
Back
Top