How to do Drag and Drop Multiple Items
I'm trying to do Drag and Drop from one listbox to another.
The code I have now is as follows :
Code:
Private Sub ListBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox1.MouseDown
If e.Button = MouseButtons.Left Then
ListBox1.DoDragDrop(ListBox1.Items(ListBox1.SelectedIndex).ToString(), DragDropEffects.Copy)
End If
End Sub
Private Sub ListBox2_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListBox2.DragDrop
ListBox2.Items.Add(e.Data.GetData(DataFormats.StringFormat, False))
End Sub
Private Sub ListBox2_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListBox2.DragEnter
If (e.Data.GetDataPresent(DataFormats.Text)) Then
e.Effect = DragDropEffects.Copy
End If
End Sub
THe problem is I actually need to drag and drop multiple items simultaneously. Listbox1.SelectedItems to be exact. Anyone have any idea how I can do this or a link that shows how to do this?