Closed Thread
Results 1 to 5 of 5

Thread: Problems with listing high scores

  1. #1
    yash is offline Newbie
    Join Date
    Mar 2010
    Posts
    3
    Rep Power
    0

    Unhappy Problems with listing high scores

    Hi!
    I have a game i'm making and i would realy love to have a top 10 high score list at the end.
    But here's where I'm stuck - I tried writing the whole thing into a .txt file (check), then i put all the scores from the .txt file into a datagrid (check), and finaly i tried to sort them acording to the score (collumn "Score") (FAILURE!). Because when I use the sort command it sorts everything by the first digit.
    Example:
    I have scores: 80, 10, 110 and 50.
    And what it does is sort them like this: 80, 50, 110, 10 insted of 110, 80, 50, 10.
    I changed the value type to int but that didn't work.

    Then I got a little upset and made a whole SQL database just for this but when i make a connection with it and then try to open it in visual studio, it makes an instance failure (i googled for this problem, try the solutions, like making the SQL server type "Local system", but none of them worked for me).

    I'm trying to make this work for some time now but just have no luck with it.
    I would be more than happy if somebody helped me out (with a solution or another way to do the whole scoring thing).

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Golradir's Avatar
    Golradir is offline Newbie
    Join Date
    Mar 2010
    Location
    Cape Town, South Africa
    Posts
    3
    Rep Power
    0

    Re: Problems with listing high scores

    The DataGridView.Sort() method has 2 overloads. You can just insert the data you want to OR you can use the 2nd overloaded method and specify a ListSortDirection. Basically where you have
    Code:
    blabla.Sort(<your data variable>);
    add , Ascending in the brackets
    Code:
    blabla.Sort(<your data variable>, Ascending);
    Obviously you can make that Descneding if that's what you need.

  4. #3
    yash is offline Newbie
    Join Date
    Mar 2010
    Posts
    3
    Rep Power
    0

    Re: Problems with listing high scores

    Thanks for your reply, but i already tried that
    Well I played with the actual settings of datagridcolumns instead of trying to program it, and I came across a setting that defines in what format the values in the column are. I set it to custom and typed in 00000, so what that did is that it added zeroes to the score number until the number had 5 digits (e.g. 00035). When I sorted the column in that format it finally did what I wanted
    Soo... if anybody has the same problem do it like that
    Still, thanks for your reply.

  5. #4
    Golradir's Avatar
    Golradir is offline Newbie
    Join Date
    Mar 2010
    Location
    Cape Town, South Africa
    Posts
    3
    Rep Power
    0

    Re: Problems with listing high scores

    So you decided too try your best to not actually have to do any programming? Seriously?

  6. #5
    yash is offline Newbie
    Join Date
    Mar 2010
    Posts
    3
    Rep Power
    0

    Re: Problems with listing high scores

    Well..... Yeah!
    I never thought of just playing with the settings in the designer...

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. event listing
    By azoqup in forum PHP Development
    Replies: 5
    Last Post: 08-04-2010, 10:21 AM
  2. Image Listing/File Listing
    By brokenbylaw in forum PHP Tutorials
    Replies: 0
    Last Post: 03-26-2010, 01:25 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts