G
Guest
I have a DLL Winform project. I've double-clicked Settings.settings under
Properties, and create the following application setting:
Name: MySetting1, Type: string, Scope: Application, Value: c:\TestDocs
When I need the MySetting1 value, just use the following in my C# code:
string sVal = "WordDocGenDefaultDirectory";
string str = Properties.Settings.Default[sVal].ToString();
This gives me the value c:\TestDocs, which is exactly what I want. Great
stuff!
The user can specify a value other than c:\TestDocs, which needs to be
available the next time the program runs. I tried the following, which does
*not* save the new value.
Properties.Settings.Default[sVal] = newPath;
Properties.Settings.Save();
Any suggestions on how to save the new value so it's available the next time
the program runs?
Thanks,
Properties, and create the following application setting:
Name: MySetting1, Type: string, Scope: Application, Value: c:\TestDocs
When I need the MySetting1 value, just use the following in my C# code:
string sVal = "WordDocGenDefaultDirectory";
string str = Properties.Settings.Default[sVal].ToString();
This gives me the value c:\TestDocs, which is exactly what I want. Great
stuff!
The user can specify a value other than c:\TestDocs, which needs to be
available the next time the program runs. I tried the following, which does
*not* save the new value.
Properties.Settings.Default[sVal] = newPath;
Properties.Settings.Save();
Any suggestions on how to save the new value so it's available the next time
the program runs?
Thanks,