For Each DGR As DataGridViewRow In dgvJobs.SelectedRows ' Added to stop error occuring when destination dgv columns do not exist If dgvProject.ColumnCount = 0 Then For Each ColumnHeader As DataGridViewColumn In dgvJobs.Columns Dim name As String = ColumnHeader.Name Dim header As String = ColumnHeader.HeaderText dgvProject.Columns.Add(name, header) Next End If Dim i As Integer = DGR.Index Dim dr As DataGridViewRow = CType(dgvJobs.Rows(i).Clone, DataGridViewRow) dgvProject.Rows.Add(dr) Next
Hi I'm making a form where I have two datagridviews. The first dgv is databound to a database. The second dgv is not databound. I want to allow users to drag rows from dgv1 and drop them on dgv2. At the moment I have managed to get it to the point where I can drag from dgv1 to dgv2 but the result is an empty row being added.
When I try adding a row without using .Clone I get this error "Row provided already belongs to a DataGridView control."
Any ideas, or better yet, solutions?