If DataGridView2.ColumnCount = 0 Then
DataGridView1.Columns.Cast(Of DataGridViewColumn) _
.ToList _
.ForEach(
Sub(col)
DataGridView2.Columns.Add(CType(col.Clone, DataGridViewColumn))
End Sub
)
End If
Kevin, your code worked perfect, was something else wrong with my form.
Thank's a lot
A workaround for me could be to add the headers, and names before adding the selected rows...this works as long as the data tables in the Oracle database is not changed.
Code:
DgOneCell.ColumnCount = DgAllGases.ColumnCount
' Set the column header names.
DgOneCell.Columns(0).Name = "Name1"
DgOneCell.Columns(1).Name = "Name2"
DgOneCell.Columns(2).Name = "Name3"
DgOneCell.Columns(3).Name = "Name4"
DgOneCell.Columns(4).Name = "Name5"
DgOneCell.Columns(5).Name = "Name6"
For Each rows As DataGridViewRow In DgAllGases.SelectedRows
DgOneCell.Rows.Add(CloneWithValues(rows))
Next