Dim x As Integer For x = 0 To DataGridView1.Columns.Count - 1 DataGridView2.Columns.Add(DataGridView1.Columns(x).Clone()) Next MsgBox("clm added:") For x = 0 To DataGridView1.Rows.Count - 1 DataGridView2.Rows.Add(DataGridView1.Rows(x).Clone()) Next
If dgv_copy.Columns.Count = 0 Then For Each dgvc As DataGridViewColumn In dgv_org.Columns dgv_copy.Columns.Add(TryCast(dgvc.Clone(), DataGridViewColumn)) Next End If Dim row As New DataGridViewRow() For i As Integer = 0 To dgv_org.Rows.Count - 1 row = DirectCast(dgv_org.Rows(i).Clone(), DataGridViewRow) Dim intColIndex As Integer = 0 For Each cell As DataGridViewCell In dgv_org.Rows(i).Cells row.Cells(intColIndex).Value = cell.Value intColIndex += 1 Next dgv_copy.Rows.Add(row) Next
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)