Results 1 to 4 of 4

Thread: Drag and Drop File into List View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    NY, USA.
    Posts
    240
    Hi,
    Could someone please show me how to drag and drop a file into a ListView Control.

    Thanks
    Omar
    [email protected]
    http://omar.caribwalk.com
    To God Be The Glory

    I see Tech People ...

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Funny! I just didn't have to modify anything in the code. Here you go:

    set the listbox props:
    oledragmode=1
    oledropmode=1
    and the code:
    --------------------------------------
    Private Sub Lista_OLEDragDrop(data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
    If data.GetFormat(15) Then
    For n = 1 To data.Files.Count
    lista.AddItem data.Files(n)
    Next n
    Else
    End If
    End Sub
    --------------------------------------

    Hope this will help.

    After edit: Oh no! I knew it. There was something I just had to modify.

    [Edited by kedaman on 03-21-2000 at 08:00 AM]

  3. #3
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    kedaman that code is for a list box NOT a list view!
    Mark
    -------------------

  4. #4
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Code:
    Private Sub ListView1_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
      Dim itmX As ListItem
      Dim i As Integer
      If Data.GetFormat(15) Then
        For i = 1 To Data.Files.Count
          
          Set itmX = ListView1.ListItems.Add(, , Data.Files(i))
        Next i
      
      End If
    End Sub
    setting the correct icon is a bit trickier though!

    I'll have to have a think about that one
    Mark
    -------------------

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