|
Question : Application Settings are not functioning
|
|
I have an application that has been using User Configuration settings that were defined in the Designer/Settings tab. The application reads them fine. I recently added some Application settings by directly editing the app.config XML file, using lines simialr to this:
Since then, the application doesn't read the new AppSettings. It still reads the User settings, just not the App settings. (using System.Configuration; is declared). When the application encounters:
string engrNamesPath = ConfigurationSettings.AppSettings["EngrNamesPath"];
it returns "null"
I am stumped.
|
|
Answer : Application Settings are not functioning
|
|
I have found a way to fix this problem.
If I declare a reference to "application name".Properties by declaring:
using MyApp.Properties;
Then you can get the values added to the "Settings" tab of the application properties, i.e.,
string engrNamesPath = Settings.Default.EngrNamesPath;
The way I was trying to use:
using System.Configuration;
then
string engrNamesPath = ConfigurationSettings.AppSettings["EngrNamesPath"];
returns Null for some reason.
|
|
|
|