No application config file??

  • Thread starter Thread starter Jesse
  • Start date Start date
After successfully installing the OpenNETCF SDK, I created an "OpenNETCF"
project. I added an xml file to the project called "XMLFile1.xml".

The xml file has the following text:
<?xml version="1.0" encoding="utf-8" ?>

<configuration>

<appSettings>

<add key="WebServiceURL"
value="http://10.0.0.73/WebService1/Service1.asmx" />

<add key="Key 2" value="app Settings Value 2" />

<add key="Key 3" value="app Settings Value 3" />

</appSettings>

</configuration>


I added the following code behind a button in the application:


Dim o As New OpenNETCF.Configuration.ConfigurationSettings

o.FilePath = "\Program Files\OpenNETCFApplication1\XMLFile1.xml"

MsgBox(CStr(o.AppSettings.Keys.Count))



I would expect to get "3". Instead I get "0". The file path is correct.
Any ideas?



Thanks,

Jesse
 
Few things:

1) AppSettings is a static member that represents the contents of a
particular file: appname.exe.config.
2) To use this class with an arbitrary file do the following:
Dim o As New OpenNETCF.Configuration.ConfigurationSettings

o.FilePath = "\Program Files\OpenNETCFApplication1\XMLFile1.xml"

o.Read()

MsgBox(CStr(o.List.Keys.Count))
 
Back
Top