|
-
May 27th, 2010, 08:26 AM
#1
Thread Starter
Addicted Member
[RESOLVED] Correct method for application settings
Was just curious to know if there is a typical method for handling application settings. I have two types of settings; Applications settings (like user preferences) and 'system' settings (server IP, options related to the industrial machine it's running on that need to be set at startup, ports that certain devices are attached to, etc).
I was thinking that what I'm referring to as system settings would be in a configuration.ini type of file that can easily be edited. Then save the other settings either in the registry or a separate user.cfg file that would not be edited on it's own but changed through option settings in the program itself.
Am I over complicating this? Is it normal to use the registry to store program settings or would it be better in a file?
-
May 27th, 2010, 08:41 AM
#2
Re: Correct method for application settings
Completely so...
Open your project properties, go to the settings tab.... BAM! That's exactly what those are for... For scope, for your "application" settings (which are really user settings) you'll want to use the "User" scope... and for your "system" settings, use "Application" scope...
Here's what will happen:
an application.config file will be created. that is the design time file with the settings and the default user settings. When you run the app, it gets copied to the bin folder and renamed yourapp.exe.config. I mention this because people post "where' my config file when I run the app?"
When you change any of the user settings, it gets saved to the USER'S PROFILE in a yourapp.user.config file. Both are in XML format, both can be easily edited, but really shouldn't be done from outside the app. Since this is built into VB, it's easy to use and setup.
-tg
-
May 27th, 2010, 09:03 AM
#3
Thread Starter
Addicted Member
Re: Correct method for application settings
Embarrassing, but I didn't even know that was there.
Just took a look and seems pretty easy to setup and use. Thanks tg!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|