Private Sub DataGridView1_CellContentDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentDoubleClick
Try
Dim oIndex = e.RowIndex
Call AddRowToDGV2(oIndex)
Catch ex As Exception
End Try
End Sub
Sub AddRowToDGV2(ByVal intRowIndex As String)
Try
Dim row As DataGridViewRow = Me.DataGridView1.Rows(intRowIndex)
'This is where the row from the ist DGV is effectively copied and added to the second DGV
If row IsNot Nothing Then
Dim newRow As New DataGridViewRow()
newRow.CreateCells(Me.DataGridView1)
For i As Integer = 0 To row.Cells.Count - 1
newRow.Cells(i).Value = row.Cells(i).Value
Next
If Me.DataGridView1.Rows(row.Index).DefaultCellStyle.ForeColor <> Color.OrangeRed Then
'Don't add the row if it is already owolintshi
Me.DataGridView2.Rows.Add(newRow)
End If
End If
'***Color line orange -on the drop
Me.DataGridView1.Rows(row.Index).DefaultCellStyle.ForeColor = Color.OrangeRed
Catch
MsgBox("There was a problem calling the scenario loading from a drag and drop")
End Try
End Sub
ASKER
Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET framework, but also supported on other platforms such as Mono and Silverlight. Microsoft launched VB.NET as the successor to the Visual Basic language. Though it is similar in syntax to Visual Basic pre-2002, it is not the same technology,
TRUSTED BY
https://www.experts-exchange.com/questions/22119675/Datagridview-copy-and-paste-row-data-to-another-row.html