Results 1 to 6 of 6

Thread: [RESOLVED] [2005] FolderBrowserDialog Sorting????

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,521

    Resolved [RESOLVED] [2005] FolderBrowserDialog Sorting????

    I have always assumed the FolderBrowserDialog displayed the directories in alphabetical order. But by the looks of it, this is incorrect. Is there a way to get it to display the directories alphabetically? Or do I not know how to alphabetize? I have posted a picture so you don't think I'm wacked out on something.
    Attached Images Attached Images  
    Visual Studio Team Edition 2005
    GDI+ Links: Bob Powell VB.Net Heaven
    API Links: All API Pinvoke.Net
    VB6 to VB.Net: Visual Basic 6 to .NET Function Equivalents (Thread)

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2005] FolderBrowserDialog Sorting????

    Stumped me for a few minutes, but I see what's going on here...

    When it is sorting, its stripping the leading 0 off and going to the next digit. So if you take those 0's off, its in the correct order, notice how the 2 top ones that are out of order would be in correct order if the 0 was not present, same with the one that starts with 02

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,521

    Re: [2005] FolderBrowserDialog Sorting????

    I see what you mean now. But that still doesn't make sense. If that is how it's supposed to function then the first 4 are out of function.
    Visual Studio Team Edition 2005
    GDI+ Links: Bob Powell VB.Net Heaven
    API Links: All API Pinvoke.Net
    VB6 to VB.Net: Visual Basic 6 to .NET Function Equivalents (Thread)

  4. #4
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2005] FolderBrowserDialog Sorting????

    if there is no number after the 0, it considers it 0.. if there is a number after the 0, it is truncating it off....

    I'm not saying its correct, looks like a bad sorting routine either within the framework, or in the underlying win32 control itself, but it is what it is...

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] FolderBrowserDialog Sorting????

    I think that you'll find that that is a Windows XP feature. Everyone b*tches that Folder1, Folder2 and Folder10 are sorted "alphabetically" instead of how a human would sort them, so Microsoft added functionality to XP to sort files and folders in a more "human" way. What is happening in your case is XP is reading the leading digits as a number and sorting them numerically, then those that start with the same number are sorted alphabetically after that. The first four start with "0" so the number is stripped of altogether and they are sorted alphabetically by the letters that come after the zero. The next eight all start with the number one ("01" is considered to be the number 1) so they are all sorted alphabetically on whatever comes after the "1". After that comes the those that start with the number 2, where "02" is considered the number 2. By default XP will treat leading and trailing digits in a file or folder name as numbers. It would be too hard work to treat other digits as numbers though. You can turn this functionality off in XP but it has nothing whatsoever to do with .NET.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,521

    Re: [RESOLVED] [2005] FolderBrowserDialog Sorting????

    Thanks for the info
    Visual Studio Team Edition 2005
    GDI+ Links: Bob Powell VB.Net Heaven
    API Links: All API Pinvoke.Net
    VB6 to VB.Net: Visual Basic 6 to .NET Function Equivalents (Thread)

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