How can I drag and drop multiple listbox items in vb.net? I see several examples for VB6 on the forums, but none for .Net.
Does anyone know how to do this?
Here is the code I am using to drag one item at a time...
VB Code:
Private Sub lst1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lst1.MouseDown If e.Button = MouseButtons.Left Then If lst1.SelectedIndex() <> -1 Then lst1.DoDragDrop(lst1.Items.Item(lst1.SelectedIndex()).ToString, DragDropEffects.Copy) End If End If End Sub Private Sub lst2_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lst2.DragEnter If (e.Data.GetDataPresent(DataFormats.Text)) Then e.Effect = DragDropEffects.Copy End If End Sub Private Sub lst2_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lst2.DragDrop If Not AlreadyAdded(e.Data.GetData(DataFormats.Text)) Then lst2.Items.Add(e.Data.GetData(DataFormats.Text)) End If End Sub
I just can't figure out how to have multiple items transfer in one drag and drop opperation...
Thanks for any help,
Squirrelly1


Life is grand for a coder, no?
Reply With Quote