I have the following set up in the config file and trying to read it with the following vb.net code, i have referecnced the system.config.dll but each time the value comes back as nothing. The config file is at the same level as the code module. Any one got a clue? if so can they give it to me please.
vb.net code line:-
voluntaryExcess = System.Configuration.ConfigurationManager.AppSettings("tourerVoluntary")
Config file:-
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<appSettings>
<add key ="tourerVoluntary" value="150"/>
</appSettings>
<system.diagnostics>
<sources>
<!-- This section defines the logging configuration for My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the Application Event Log -->
<!--<add name=&quot;EventLog&quot;/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog"
type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
initializeData="FileLogWriter"/>
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
<!--<add name=&quot;EventLog&quot; type=&quot;System.Diagnostics.EventLogTraceListener&quot; initializeData=&quot;APPLICATION_NAME&quot;/> -->
</sharedListeners>
</system.diagnostics>
</configuration>
vb.net code line:-
voluntaryExcess = System.Configuration.ConfigurationManager.AppSettings("tourerVoluntary")
Config file:-
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<appSettings>
<add key ="tourerVoluntary" value="150"/>
</appSettings>
<system.diagnostics>
<sources>
<!-- This section defines the logging configuration for My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the Application Event Log -->
<!--<add name=&quot;EventLog&quot;/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog"
type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
initializeData="FileLogWriter"/>
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
<!--<add name=&quot;EventLog&quot; type=&quot;System.Diagnostics.EventLogTraceListener&quot; initializeData=&quot;APPLICATION_NAME&quot;/> -->
</sharedListeners>
</system.diagnostics>
</configuration>