Need to access value from app.config file
-
Hi, I am trying to use the settings.designer.cs file for a value that needs to be put into the app.config file. My config(auto-generated by VS2005) file now looks like this:
C:\Web\App_Data\Messages.mdb; From the code when i access this property i am using this code: Settings1 set = Settings1.Default; string str = set.DatabasePath; return str; The above line of code returns null... can anyone explain what am i missing here???
-
Hi, I am trying to use the settings.designer.cs file for a value that needs to be put into the app.config file. My config(auto-generated by VS2005) file now looks like this:
C:\Web\App_Data\Messages.mdb; From the code when i access this property i am using this code: Settings1 set = Settings1.Default; string str = set.DatabasePath; return str; The above line of code returns null... can anyone explain what am i missing here???
Try this:
Properties.Settings set = Properties.Settings.Default; string str = set.DatabasePath; return str;
or simplyreturn Properties.Settings.Default.DatabasePath;
Cheers, Craig ** I'd rather try and fail than fail to try ;) **