goodmorningsky Posted January 9, 2004 Posted January 9, 2004 I can read Configuration file using AppSettingsReader.GetValue(key, type); But, I want to write value corresponding the key. I counldn't find method like AppSettingsWriter.WriteValue(key, type); How can I do this? Is there api doning this? Quote Sun Certified Web component Developer, Microsoft Certified Solution Developer .NET, Software Engineer
VBAHole22 Posted June 14, 2006 Posted June 14, 2006 Great question! Although I think you wrote this during the 1.0 or 1.1 days 2.0 is supposed to simplify this process. Acoording to msdn you can do the following: Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); config.AppSettings.Settings["mySetting"].Value = "myNewValue"; config.Save(ConfigurationSaveMode.Modified,true); ConfigurationManager.RefreshSection("appSettings"); But I have no luck with this. No errors, just no writing to the config file. I am in VS05 writing a 2.0 win form application. Any suggestions? Quote Wanna-Be C# Superstar
mskeel Posted June 14, 2006 Posted June 14, 2006 It looks like you guys are using C# so my advice won't be very helpful...but if you were using VB8, I'd tell you to check out the My namespace. 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.