Hi

I was wondering if anyone knew how to make a highscore list in VB 2005. This is for my project which is basically a quiz, and I would like the user to be able to click on the highscore button so that they can see their name, ranking and score.

Thanks

This is appreciated.

Save it in an array(9). 0 being higest, 9 being 10 best. Now when someone finishes a game compart their score to array(9). If it is lower then no point doing anything else it is not in the top 10. If it is greater then array(9) then check 8 if larger then 8 check 7, etc. When you find one that is higher then the current one then you have found where to place it. Move all from here down one and add the current score to the array. i.e. if the current score is greater than array(7) and less than array(6) then move array(8) to array(9), array(7) to array(8) and then place the current score in array(7).
When the game is over with save the array to a file and then read it in when starting the game.
Hope this makes sense.

Save it in an array(9). 0 being higest, 9 being 10 best. Now when someone finishes a game compart their score to array(9). If it is lower then no point doing anything else it is not in the top 10. If it is greater then array(9) then check 8 if larger then 8 check 7, etc. When you find one that is higher then the current one then you have found where to place it. Move all from here down one and add the current score to the array. i.e. if the current score is greater than array(7) and less than array(6) then move array(8) to array(9), array(7) to array(8) and then place the current score in array(7).
When the game is over with save the array to a file and then read it in when starting the game.
Hope this makes sense.

When you say "save it to an array", how do you do that? Can you give me an example?


Thanks

Try this:

Dim ary As New ArrayList()
        Dim str As String = FormatNumber(CLng(TextBox2.Text), 0)
        If str.Length < 9 Then str = StrDup(9 - str.Length, " ") & str
        str &= "    " & TextBox3.Text
        ary.Add(str)
        ary.Sort()
        ary.Reverse()
        If ary.Count > 10 Then ary.RemoveAt(10)
        TextBox1.Clear()
        For x As Int16 = 0 To ary.Count - 1
            TextBox1.Text &= ary(x) & vbNewLine
        Next

Consider using a database file to store all scores. The following might work.
1) Create data dictionary SCORES using database explorer
2) Create table scores with 2 fields, NAME and SCORE, maybe also SCORE_DATE
3) Create your new project and add datasource SCORES to it.
4) Drag datagrid view of SCORES to your form.
5) Change fillby query method to SELECT * FROM SCORES PRDER BY SCORE DESCEND
6) Change 5) to use ROWNUMBER(10) to limit to tope 10.
Hope this helps.
Bill P.

This question has already been answered. Start a new discussion instead.