Results 1 to 4 of 4

Thread: [RESOLVED] drag and drop order question

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    64

    Resolved [RESOLVED] drag and drop order question

    Code:
                  Dim f() As String
    
                    ' Assign the files to an array.
                    f = e.Data.GetData(DataFormats.FileDrop)
    I use the above code in my DragDrop event to get a list of files which were drag and dropped onto my form. My only problem is the order of the files. If I selected a bunch of files in explorer and drag them onto my form they are put into the f() array in a different order then they were selected and dragged.

    Any suggestions?

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    64

    Re: drag and drop order question

    if I select these files:

    1.jpg
    2.jpg
    3.jpg
    4.jpg
    5.jpg
    6.jpg

    and set a breakpoint after the last line of code and watch f() it's arranged like this after the drag and drop operation.

    (0) 3.jpg
    (1) 4.jpg
    (2) 5.jpg
    (3) 6.jpg
    (4) 1.jpg
    (5) 2.jpg

    Now is that explorer passing them in that order or is GetData sorting them somehow?

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: drag and drop order question

    If you selected them in the order posted then it may be that in explorer its order is different since you can have 5 different view and 4 different sorting methods. in other words, what you see is not necissarily the actual index order.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    64

    Re: drag and drop order question

    yeah that must be it.. I just re-sorted in my app.. solved the issue

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