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

    Need help with sorting in c#

    Hi, Im using Visual Studio 2010 to create my project in.

    So far I have read in a file and displayed this into a list box.
    However I need to be able to display the information by Names ascending and another function that would display the information by highest mark first


    The text file I am reading in looks like this where the name is at the start and the mark is at the end where they are separated by a space.

    Normal file read in
    ==============
    Andy Morris 5
    Roberto Edgar 2
    James Cox 4
    April Hockley 10
    Warren Day 9
    ETC........


    Sorted by name
    ==============
    April Hockley 10
    Andy Morris 5
    James Cox 4
    Roberto Edgar 2
    Warren Day 9


    Sorted by grade
    ============
    April Hockley 10
    Warren Day 9
    Andy Morris 5
    James Cox 4
    Roberto Edgar 2

    If it makes it easier I can change the way the text is written to the file.

    Thanks in advance

  2. #2
    Join Date
    Jun 2001
    Location
    Melbourne/Aus (C# .Net 4.0)
    Posts
    686

    Re: Need help with sorting in c#

    Can you post the code here, showing how you read the text from the file. Then we will be able to see what internal structure you have used and better answer your question.
    Rob
    -
    Ohhhhh.... Old McDonald was dyslexic, E O I O EEEEEEEEEE.......

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