Results 1 to 3 of 3

Thread: Same List Box Drag & Drop and re-order list

  1. #1
    Guest

    Question

    List Box Control Question (Not Listview control)

    Can someone show me how to drag and drop a list item
    from one position to another in the same list box and have the item list automatically reorder itself?

    Thanx!

    JC
    [email protected]

  2. #2
    Fanatic Member ExcalibursZone's Avatar
    Join Date
    Feb 2000
    Location
    Western NY State
    Posts
    908
    This project Requires a Listbox called List1. Set List1's OLEDragMode to 1-Automatic, OLEDropMode to 1-Manual, and Sorted to True.
    Code:
    Dim Temp As String
    
    Private Sub Form_Load()
        List1.AddItem "abba"
        List1.AddItem "yabba"
        List1.AddItem "babba"
        List1.AddItem "dabba"
        List1.AddItem "nabba"
        List1.AddItem "habba"
    End Sub
    
    Private Sub List1_OLECompleteDrag(Effect As Long)
        List1.AddItem Temp
    End Sub
    
    Private Sub List1_OLEStartDrag(Data As DataObject, AllowedEffects As Long)
        Temp = List1.List(List1.ListIndex)
    End Sub
    -Excalibur

  3. #3
    New Member
    Join Date
    May 2001
    Posts
    4

    Lightbulb

    Try this, it worked for me.

    http://www.mvps.org/ccrp/download/ccrpdownloads.htm

    Down the "draglist" control and run it in your VB.

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