i am going to use either a text file or xml for a simple (i mean very simple) game i wrote but i am wondering what would be the best way to have an options form. i am NOT asking for code just pointers. i want to have an options menu that gets the settings from the file, however they need to load if the file exists when the program starts since the program will read them. would just using a static class that i assign values to be best and have it pullt he values since then the whole program can be on the same page?
what is the best way to handle settings
Page 1 of 14 Replies - 631 Views - Last Post: 10 August 2010 - 07:18 AM
#1 Guest_Guest*
what is the best way to handle settings
Posted 08 August 2010 - 09:15 AM
Replies To: what is the best way to handle settings
#2
Re: what is the best way to handle settings
Posted 08 August 2010 - 11:07 AM
You could certainly have a static class pull in and store the settings. This was a popular use of structures back in the early programs. You could also decide to just have a series of functions which fetch settings from the file as needed. It is a bit more work and a little bit more clumsy, but still an option. You can also store settings internally to the program using the Application settings (ConfigurationSettings class).
Which way you choose depends on the comfort level, ability to access the settings, and the number of settings you want or plan to have.
Which way you choose depends on the comfort level, ability to access the settings, and the number of settings you want or plan to have.
#3
Re: what is the best way to handle settings
Posted 08 August 2010 - 02:02 PM
I'll throw my vote in for the app.config or settings.settings file. Both are quite easy to get to from code that's already built in.
#4
Re: what is the best way to handle settings
Posted 10 August 2010 - 07:07 AM
I would load setting in memory in some static class and then retrieve them as needed... That way you don't have to access your settings file every time you need some setting.
#5
Re: what is the best way to handle settings
Posted 10 August 2010 - 07:18 AM
The app.config or settings.settings file is the best way to use settings for your .NET application. There are built in functions that will simplify your code greatly.
Page 1 of 1
|
|

New Topic/Question
Reply
MultiQuote







|