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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Storing Config Items for a vb.net application 1

Status
Not open for further replies.

EnemyGateIsDown

Technical User
Oct 3, 2002
235
GB
Hi Guys,

I generally develop Web applications in ASP.NET and use a web.config file to store user configurable items like the database connection etc.

Can anyone tell me how best to store and access these items in a VB.NET application?

Any help is as always greatly appreciated.

Cheers,

Chris
 
did you have a look at "SaveSetting Function"?

________________________________________________________
Zameer Abdulla
Help to find Missing people
Sharp acids corrode their own containers.
 
Add an Application Configuration file (App.Config)

-or-

Add an Assembly Resource File (Resource1.Resx)

__________________
* I would prefer the second one. Easily, using its datagrid, you specify a name (the key), a value and a type. Leaving it empty (null) the default is System.String. A comment field is also available for your own help. Last there is the mimeType.

Use the System.Resources namespace to handle with the resX file.


Hope these help!
 
I would highly recommend NOT using the App.Config file to store user settings. The App.Config file is going to sit in the application's folder. The application will likely be installed in c:\Program Files. Many network support staffs will lock down the C:. If you attempt to write to the App.Config file and the C: is locked, it will throw and exception.

Not only that, but you lose the ability to run different settings for different users, and roaming profiles.

I would recommend using a nINI or something like this FAQ: faq796-6320 switch out the folders with the environment.specialfolders.applicationdata (not sure on the syntax to grab that folder off the top of my head...) And you should have a dynamic solution that won't choke on security issues and will give you all the benefits modern Windows networks.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top