Copy Row from one DataGridView to another

First, copy the schema of the table you want to copy, to the new table

Dim dtTable As DataTable

Dim dtTableNew As DataTable

Dim oDataRow As DataRow


dtTable =


dtTableNew = dtTable.Clone
oDataRow = dtTable.Rows(



Me.dgAssignIOPayments.DataSource = dtTableNew

For this case, I wanted the user to select a row, copy that to a holding area, where the user will then
select from another data grid to merge data entries in a controlled environment.
dim newTable as new dataTable

after that, using ImportRow you can copy the rows you want
For n As Integer = 0 To originalTable.Rows.Count – 1



if you were to use the newTable.AddRow, you might just get the following error:
Rows cannot be programmatically added to the DataGridView’s rows collection when the control is data-bound. 
This entry was posted in Computers and Internet. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s