Hello all
I have a form with two datagridviews.
Grid A is polulated with orders from DB, grib B has an empty table with the same column name as grid A.
Im currently draging orders from Grid A onto grid B.
My isue is that since grid B has only one empty row, it only alows to drag one item.
What I want to accomplish is to add an empty row in grid B In index 0 (the firsst row)
In the dragdrop event I tried to add an empty row, but this code inserts an empty row before the firtst row that was added

Private Sub DGV_Pulled_DragDrop(sender As Object, e As DragEventArgs) Handles DGV_Pulled.DragDrop Dim RowsSource As Integer = Convert.ToInt32(e.Data.GetData(Type.GetType("System.Int32"))) Dim clientPoint As Point = Me.DGV_Pulled.PointToClient(New Point(e.X, e.Y)) Dim hit As DataGridView.HitTestInfo = Me.DGV_Pulled.HitTest(clientPoint.X, clientPoint.Y) If hit.Type = DataGridViewHitTestType.Cell Then DGV_Pulled.Rows(hit.RowIndex).Cells(hit.ColumnIndex).Value = DGV_Orders.Rows(RowsSource).Cells("oe").Value DGV_Pulled.Rows(hit.RowIndex).Cells(hit.ColumnIndex + 1).Value = DGV_Orders.Rows(RowsSource).Cells("Address").Value Dim order As String = DGV_Orders.Rows(RowsSource).Cells("OE").Value End If Dim row As New DataGridViewRow With row .CreateCells(DGV_Pulled) .Cells(0).Value = DBNull.Value End With Me.DGV_Pulled.Rows.Add(row) End Sub

I solved.
Instead of using add I used Insert, to insert the empty row.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.