Click here to Skip to main content
15,867,453 members

Response to: How to move selected rows of one datagridview to another datagridview.

Revision 1
Hi,
this code might help you.

Dim DsTo As New DataSet '' '' Data set 

'' '' Code on button Click
      for DgvToFor Each r As DataGridViewRow In DGVFrom.SelectedRows
           Dim Drto As DataRow = DsTo.Tables(0).NewRow
           For c As Integer = 0 To DGVFrom.ColumnCount - 1
               Drto(c) = r.Cells(c).Value
           Next
           DsTo.Tables(0).Rows.Add(Drto)
           DGVFrom.Rows.Remove(r)
       Next



RKS
Posted 31-Dec-12 22:11pm by Rahul K Singh.
Tags: