Results 1 to 2 of 2

Thread: How to do Drag and Drop Multiple Items

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2002
    Location
    Malaysia
    Posts
    64

    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?

  2. #2
    Hyperactive Member
    Join Date
    Dec 2001
    Location
    Dublin, Ireland
    Posts
    262
    Quick Plug http://www.creativeprogrammers.com/a...drop-62-1.html

    This includes how to drag from one listview to another. It might help you work out the best way to do what you need. If it doesn't then email me. I'll see if I can help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width