0

Hi im using a basic application to list and access images from a specific folder.

what it do:

Open the folder from FolderChooser than get all the images file names from there

CODE:

  foreach (String path in System.IO.Directory.GetFiles(folderBrowserDialog1.SelectedPath))
            {
                System.Diagnostics.Debug.WriteLine(path);               
            }

at the windows file explorer i have this listing:

000-01
000-02
000-03
...
000-09
000-10
000-11
...

and when i open the folder and list the files at the VisualStudio output, it show me this result:

..
000-10.jpg
000-100.jpg
000-101.jpg
000-102.jpg
..
000-11.jpg
000-110.jpg
000-111.jpg

why? ok i know that its because the number order, but WHY for Visual Studio it has a wrong ordering? (different than the windows explorer)

how can i fix the VisualStudio order?

user2582318
  • 1,607
  • 5
  • 29
  • 47
  • 3
    PInvoke StrCmpLogical... or http://stackoverflow.com/q/1601834/327083 – J... Jun 14 '16 at 23:26
  • see also : http://stackoverflow.com/q/8793856/327083 – J... Jun 14 '16 at 23:27
  • What makes it wrong? If you change your explorer ordering to by date or by type, would you expect .NET to know? .NET has lots of ways to sort collections built in, and you can easily write your own if you need to. Don't worry about the order you start with: put your collection in the order you want it to be in. – Paul Hicks Jun 14 '16 at 23:31
  • Search term "natural sort order" if you want alternative solutions to one provided in linked as duplicate http://stackoverflow.com/questions/1601834/c-implementation-of-or-alternative-to-strcmplogicalw-in-shlwapi-dll – Alexei Levenkov Jun 14 '16 at 23:49

0 Answers0