Denaes Posted July 1, 2004 Posted July 1, 2004 I found PlausiblyDamp's post about reading from the app.config file, which is rather nice. Dim appConfig As New Configuration.AppSettingsReader Label1.Text = appConfig.GetValue("ConnectionString", GetType(String)).ToString() Thats all the code you need to get into a setting, thats very nice. How about writing to an AppConfig file, once you have the settings in place, if the settings are changed during runtime? say during runtime, I had an option were the user could change the "ConnectionString" (most likely just the path and/or password) and I wanted to save it? I'm sure this wouldn't be terribly hard to write a procedure that would accept two parameters to tell it which tag to find and what setting to place there, but is there a standard way? I've heard about XML Serialization, but this seems much easier at the moment :) Quote
Administrators PlausiblyDamp Posted July 1, 2004 Administrators Posted July 1, 2004 The application.config file is really designed as an administrative feature - it allows you to move key settings out of the application code (and away from things like the registry) to allow an admin to reconfigure the app after deployment. It isn't really designed to be modified from within the application itself - one major reason is security: on XP pro and better then a normal user doesn't have write permissions to the applications folder and any update would fail (or all users would have to be admins :eek: ). Serialisation is fairly easy when you look at it and through this method you could store settings either per user or per machine via the OS's profiles. Not near VS at the moment but I think you can get to a list of these through Environment.SpecialFolders or similar. If you require any help with serialisation then feel free to ask here. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
mocella Posted July 1, 2004 Posted July 1, 2004 Look into the Configuration Management Application Blocks: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/cmab.asp While you may not make use of all the functionality, you can pick and chose and not reinvent the wheel on this. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.