Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Settings Files

Status
Not open for further replies.

joshmshrf

Programmer
May 22, 2008
8
US
I am working on understanding how to use settings files within my application. I had used them in .Net 1.1 with the Enterprise Library but it seems they've changed quite a bit since .Net 2.0 was released. I am currently using VS2008 and my app is targeted for .Net 3.5 but what I'm trying to do was introduced in .Net 2.0.

I like the interface and functionality that is gained from using the default settings for my application but I would like to move those settings into an external file.

I have added a "Settings file" to my application but cannot figure out how to address the specific file to retrieve the settings.

I have read numerous articles on configuration in .Net 2.0 but it seems overly complex compared to the settings files that are available.

I have 2 questions when it comes to external settings:
1. How do I access the info in a .settings file that has been added to my application.
2. Everything I've read about using the system.configuration namespace and its options seems like it would work but is overly complex. Is there a reason I should follow this route instead?

Any assistance or info you can provide is appreciated.

Thanks,

Josh
 
That is the technique that I want to use but I want to be able to specify where the .settings file is located. I'd like to use settings files for my configuration and use the built-in interface to manage them. My app is going to run as a service and so I'd rather not have it all be application (which I can access programatically to change) or user which is specific to the account that the app runs as.

I'm not sure how to access a .settings file that I added to my project. I can only see how to access the settings that article specifies through the My.Settings. methods.

Thanks,

 
As far as I know that is impossible. That is just the behavior of a .net program. Now you can create your own xml file and read/write from as your own way for settings.

-I hate Microsoft!
-Forever and always forward.
-My kingdom for a edit button!
 
It would be nice if that would be possible but at the same time I guess they don't like making it that easy.

I went ahead and made my own classes to manage the config files.

Thanks,

Josh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top