المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Quick app.config question



C# Programming
07-06-2010, 02:33 AM
I have a default directory saved in my app.config and also another directory.
In the options of my program the user is supposed to be able to change the other directory or restore the default.
Yet, that doesn't seem to work properly.

At program start (first time) default and other directory have the same value. In the options I use a FolderBrowseDialog and then display the SelectedPath in a textbox. When the user clicks apply/ok the value of said textbox is written into the app.config (presumably).

Yet, when opening another form to use that changed directory (I double and triple checked for spelling mistakes), the default directory is still used.

I checked the .exe.config and .vshost.exe.config files in the debug folder, yet they, too remain unchanged after changing the directory.

But when I read the config value during runtime with config.AppSettings.Settings["elementPath"].Value, the value is the changed one as long as I stay on the same form I changed it on.

Why does that happen?
Thanks.