G
G. Kumar
Hi, is it possible to have an app.config file with an infopath visual studio .net project? I tried adding an app.config file to my project and setting it to this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="some key" value="some value" />
</appSettings>
</configuration>
Then I tried accessing the information in there through code like this:
AppSettingsReader configReader = new AppSettingsReader();
return (string)configReader.GetValue("some key",typeof(string));
This is in an onclick event for a button. When I preview the form and click the button, I get an error that's something like "key 'some key' does not exist in the appSettings section of the configuration file". Am I missing something general for app.config files? I seemed to do exactly what examples on the web did but I can't figure out this error. I thought maybe Infopath doesn't support using app.config files or something. Does anyone have any thoughts on this? Thanks!
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="some key" value="some value" />
</appSettings>
</configuration>
Then I tried accessing the information in there through code like this:
AppSettingsReader configReader = new AppSettingsReader();
return (string)configReader.GetValue("some key",typeof(string));
This is in an onclick event for a button. When I preview the form and click the button, I get an error that's something like "key 'some key' does not exist in the appSettings section of the configuration file". Am I missing something general for app.config files? I seemed to do exactly what examples on the web did but I can't figure out this error. I thought maybe Infopath doesn't support using app.config files or something. Does anyone have any thoughts on this? Thanks!