PublicClass FrmDvDragClass FrmDvDrag PrivateSub FrmDvDrag_Load()Sub FrmDvDrag_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load Me.DataGridView1.Columns.Add("code", "code") Me.DataGridView1.Columns.Add("name", "name") Me.DataGridView1.AllowDrop =True Me.ListBox1.AllowDrop =True Me.DataGridView1.Rows.Add("1", "23423") Me.DataGridView1.Rows.Add("2", "asaer") End Sub PrivateSub DataGridView1_MouseDown()Sub DataGridView1_MouseDown(ByVal sender AsObject, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGridView1.MouseDown If e.Button = Windows.Forms.MouseButtons.Left AndMe.DataGridView1.SelectedRows.Count >0Then Dim SelRow As DataGridViewSelectedRowCollection SelRow =Me.DataGridView1.SelectedRows Me.DataGridView1.DoDragDrop(SelRow, DragDropEffects.Copy) EndIf End Sub PrivateSub ListBox1_DragEnter()Sub ListBox1_DragEnter(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListBox1.DragEnter If e.Data.GetDataPresent(GetType(DataGridViewSelectedRowCollection)) Then e.Effect = DragDropEffects.Copy Else e.Effect = DragDropEffects.None EndIf End Sub PrivateSub ListBox1_DragDrop()Sub ListBox1_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListBox1.DragDrop If e.Data.GetDataPresent(GetType(DataGridViewSelectedRowCollection)) Then Dim dr As DataGridViewSelectedRowCollection dr = e.Data.GetData(GetType(DataGridViewSelectedRowCollection)) For i AsInteger=0To dr.Count -1 Me.ListBox1.Items.Add(dr.Item(i).Cells(0).Value) Next EndIf End Sub PrivateSub Button2_Click()Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.ListBox1.Items.Clear() End Sub PrivateSub Button1_Click()Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.Close() End Sub End Class