Multiselect in VB.NET 2005

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stevio
    New Member
    • Feb 2007
    • 2

    Multiselect in VB.NET 2005

    Hi
    I have a question that I hope someone can help me with. I'm selecting multiple files with an OpenFileDialog and putting the result in an array. My question is can the selected order of the files be carried into the array? If I have 3 files 'Test1', 'Test2' and 'Test3', when i select them in order (Test1, test2 then test3) the resulting array lists them as test3(0), test1(1), test2(2). There is no order, there just chucked in there. You can see it as you select them in the filename DDL in the dialog.
    Any suggestions?

    Stevio
  • willakawill
    Top Contributor
    • Oct 2006
    • 1646

    #2
    Hi. I am not absolutely certain about this and you can try it to see for yourself. I think that the file selection will return all of the selections in order except for the last one selected which gets promoted to #1. So, if you select file 2, file 3, file 1 you should get them in 1,2,3 order.

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Originally posted by willakawill
      Hi. I am not absolutely certain about this and you can try it to see for yourself. I think that the file selection will return all of the selections in order except for the last one selected which gets promoted to #1. So, if you select file 2, file 3, file 1 you should get them in 1,2,3 order.
      Yes, I've alway found that Windows appears to work that way. You get the last-selected file, followed by the rest in the order selected. This is not specific to VB.

      Comment

      • stevio
        New Member
        • Feb 2007
        • 2

        #4
        Thanks everyone! Just the answer I needed...

        Comment

        • willakawill
          Top Contributor
          • Oct 2006
          • 1646

          #5
          Originally posted by stevio
          Thanks everyone! Just the answer I needed...
          You are very welcome. Nice shades :)

          Comment

          • Killer42
            Recognized Expert Expert
            • Oct 2006
            • 8429

            #6
            I'd just like to qualify my answer. I'm not sure whether all-but-the-last are returned in the order selected, or in alphabetical order. It shouldn't be hard to check out, though.

            Comment

            • AlexW
              New Member
              • Sep 2007
              • 11

              #7
              I found this to be true as well.

              two fixes, either sort your array or listbox by setting its .sorted property to true

              or if this is impossible then make your selection by selecting the last item in the selection and then shift clicking the first item.

              This particular bug actually grabs the last item you clicked on and puts it at the head of the list followed by the rest of the items in alphabetical order (so if you select the first item in your selection last then it will end up at the head of your array/list).

              Would tell microsoft, except have no idea how to do this.

              Comment

              Working...