Results 1 to 6 of 6

Thread: Create a File/Registry/Database?

  1. #1

    Thread Starter
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Create a File/Registry/Database?

    Hi,

    How can i create a File/Registry/Database, to Save the time and

    playernames?

    Thanks,

    Sparrow1

  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: Create a File/Registry/Database?

    to give you an answer that would match the level of information you provided in your question I could give an answer like:

    "Write a text file with the data in it" or "create a table and save the data"

    I doubt either of those answers would help you though.

    Can you please explain a little more detail about what it is you are looking to do and then we will be able to provide better answers.

  3. #3

    Thread Starter
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: Create a File/Registry/Database?

    A little more explanation about my application.

    I made an application with a clock and timer and the purpose of the game

    is that the player does it correct and so fast he can!.

    What i want to do is saving the results and the playersname?

    Only the five or more fasted players shoud have a place in that list!

    How should i do that and can you give me an example which code a need?

    Thanks,

    Sparrow1

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

    Re: Create a File/Registry/Database?

    My suggestion would be to keep your results in a SortedList. Each time a player finishes a game you just add their result to the list and then trim it to five items. Because the list is always sorted you don't even have to calculate whether the most recent result belongs in the top five. To save and load your "high scores" each time you serialize and deserialize the SortedList to an XML file. The only issue that may occur is that the key values in a SortedList must be unique, which does not allow two players to have the exact same time. If you use TimeSpan objects, which measure to 100 nanosecond intervals, it is unlikely that two games will have exactly the same time. You could then round to the nearest second for display purposes.

  5. #5
    New Member
    Join Date
    May 2011
    Posts
    3

    Post Re: Create a File/Registry/Database?

    This thread is quite old but:
    The answer is: My.Settings.
    • How to create a My.Setting:
      Open your project in VB and press Project>(Your project name) Properties...>Settings> Write the setting name, type and (If you want) presetted value.
    • How to access My.Settings in code:
      Code:
      My.Settings.(Setting Name) = "You control your settings!"
    • My.Settings Saves .XML files into \Your username Directory/Users\AppData\(ProgramName)\

  6. #6
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780

    Re: Create a File/Registry/Database?

    Answering a question 6 years old with what you believe is the right answer now, may not have even existed that long ago!
    Honestly, don't do it.

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