Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Config files and reading a value

Status
Not open for further replies.

c100cbk2

Programmer
Sep 20, 2010
11
GB
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=&amp;quot;EventLog&amp;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=&amp;quot;EventLog&amp;quot; type=&amp;quot;System.Diagnostics.EventLogTraceListener&amp;quot; initializeData=&amp;quot;APPLICATION_NAME&amp;quot;/> -->
</sharedListeners>
</system.diagnostics>
</configuration>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top