Can't get the updated value from configurationsetting.appsetting

  • Thread starter Thread starter Ellis Yu
  • Start date Start date
E

Ellis Yu

Dear All,

I use function configurationsettings.appsetting to retrieve the
connection string value which stored in a file app.config. At the beginning,
it's fine that it can pick up the value according to the key passed into
function. But when I make some change in the value of app.config, it still
pick up the old value to me, not the updated one. I'd tried to rebuild the
project or quit the vb.net and re-start it again. It still pick up the old
value to me. Can anyone tell me what should I do? Please help. Thanks

Best Rdgs
Ellis
 
Make sure that the correct config file is being copied to the folder with
your executable.
 
I use function configurationsettings.appsetting to retrieve the
connection string value which stored in a file app.config. At the beginning,
it's fine that it can pick up the value according to the key passed into
function. But when I make some change in the value of app.config, it still
pick up the old value to me, not the updated one.

Yes, the app settings stuff works by grabbing and interpreting the
..config file ONCE, at startup of the app. It will *NEVER* pick up any
subsequent changes at runtime. The whole "MyApp.exe.config" stuff is
*NOT* intended to be used for settings that need to be updated - it's
designed from ground up to be read-only, and read only once, at app
startup.

If you need more dynamic settings (which can be updated and stored and
changed at runtime), you'll need to look elsewhere - check e.g.
www.codeproject.com for a wealth of "user settings" components that
will store your preferences in text, XML or other files, anywhere on
your disk (the "isolated storage" area would be the preferred location
for safety reasons), or in the registry (discouraged in .NET to do
so).

Marc
================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 
Back
Top