Results 1 to 2 of 2

Thread: Draging from a list box

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 1999
    Location
    Dublin,Ireland
    Posts
    9

    Post

    How do I drag an item from a list box and place it in a text box say?
    Is this possible?
    Any help would be appreciated.
    Thanks Sean

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

    Post

    Add a Textbox and a Listbox to a Form..
    Code:
    Private Sub Form_Load()
        Dim iIndex As Integer
        
        For iIndex = 1 To 10
            List1.AddItem "Item " & iIndex
        Next
        List1.DragIcon = LoadPicture("..\Common\Graphics\Icons\DragDrop\Drag1pg.ico")
        List1.DragMode = vbManual
    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 Text1_DragDrop(Source As Control, X As Single, Y As Single)
        If TypeOf Source Is ListBox Then
            Text1 = Source.List(Source.ListIndex)
        End If
    End Sub
    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]


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