Results 1 to 3 of 3

Thread: Drag & Drop Multiple List Entries

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Posts
    3

    Post

    When a listbox's Multiselect property is set to Extended how do you drag multiple items? If you start moving with the mouse button down, you just select more entries.

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,176

    Post

    Try this example I put together using 2 Listboxes.. (Make sure the DragMode is Manual)..
    Code:
    Private Sub Form_Load()
        Dim iIndex As Integer
        For iIndex = 1 To 10
            List1.AddItem "Item " & iIndex
        Next
    End Sub
    
    Private Sub List1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If Button = vbLeftButton Then List1.Drag vbBeginDrag
    End Sub
    
    Private Sub List1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
        List1.Drag vbEndDrag
    End Sub
    
    Private Sub List2_DragDrop(Source As Control, X As Single, Y As Single)
        Dim iIndex As Integer
        If TypeOf Source Is ListBox Then
            List2.Clear
            For iIndex = 0 To Source.ListCount - 1
                If Source.Selected(iIndex) Then List2.AddItem Source.List(iIndex)
            Next
        End If
    End Sub

    ------------------
    Aaron Young
    Analyst Programmer
    aarony@redwingsoftware.com
    adyoung@win.bright.net

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Posts
    3

    Post

    I was trying to duplicate the functionality of explorer, where you could select a bunch of items from a list, let go of the mouse, then mousedown on one of the selected items and they would all be dragged.

    Thanks.

    Chris

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