CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2018
    Posts
    12

    Sort a listbox with reverse alphabetical order?

    How do I sort a listbox as reverse alphabetical order with this code?

    Code:
    listBoxComputer.DataSource = Directory.GetDirectories(rootDir).Select(Path.GetFileName).ToList(); 
    listBoxComputer.SelectedIndexChanged += listBoxComputer_SelectedIndexChanged;

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Sort a listbox with reverse alphabetical order?

    listBoxComputer.DataSource = Directory.GetDirectories(rootDir).Select(Path.GetFileName).OrderByDescending(i => i).ToList();

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

Featured