K
kevininstructor
I added a custom section from code found on the Internet and can not get it
to work in DotNet 1.1
In the configuration file below my focus is on the "TestGroup" section, all
other parts work fine.
The following code returns a zero count for "nvc" and can not determine why?
Any thoughts?
Thanks for taking the time to look at the code,
Kevin
Dim s As String = Reflection.Assembly.GetExecutingAssembly.GetName.Name
Dim nvc As New System.Collections.Specialized.NameValueCollection
nvc = CType(System.Configuration.ConfigurationSettings.GetConfig(s &
"/TestGroup/utilitySection"),
System.Collections.Specialized.NameValueCollection)
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="sampleSection"
type="System.Configuration.SingleTagSectionHandler" />
<sectionGroup name="TestGroup">
<section name="utilitySection"
type="System.Configuration.NameValueSectionHandler,System" />
</sectionGroup>
</configSections>
<sampleSection ApplicationTitle="Sample Console Application"
ConnectionString="Server=localhost;Database=Northwind;Integrated
Security=false;User Id=sa;Password=;" />
<TestGroup>
<utilitySection>
<add key="ApplicationTitle" value="Sample Console Application" />
<add key="ConnectionString"
value="Server=localhost;Database=Taxpayers;
User Id=sa;
Password=DaffyDuck;" />
</utilitySection>
</TestGroup>
<appSettings>
<add key="PromptOnExit" value = "false" />
<add key="MyNameIs" value = "Kevin S. Gallagher" />
<add key="MyAgeIs" value = "49" />
<add key="CheckBox1Checked" value = "true" />
<add key="ComboItems" value =
"Jan,Feb,Mar,Apr,May,June,Jul,Aug,Sep,Oct,Nov,Dec" />
<add key="MyDataBase" value = "NopeIDoNotExist.mdb" />
</appSettings>
</configuration>
to work in DotNet 1.1
In the configuration file below my focus is on the "TestGroup" section, all
other parts work fine.
The following code returns a zero count for "nvc" and can not determine why?
Any thoughts?
Thanks for taking the time to look at the code,
Kevin
Dim s As String = Reflection.Assembly.GetExecutingAssembly.GetName.Name
Dim nvc As New System.Collections.Specialized.NameValueCollection
nvc = CType(System.Configuration.ConfigurationSettings.GetConfig(s &
"/TestGroup/utilitySection"),
System.Collections.Specialized.NameValueCollection)
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="sampleSection"
type="System.Configuration.SingleTagSectionHandler" />
<sectionGroup name="TestGroup">
<section name="utilitySection"
type="System.Configuration.NameValueSectionHandler,System" />
</sectionGroup>
</configSections>
<sampleSection ApplicationTitle="Sample Console Application"
ConnectionString="Server=localhost;Database=Northwind;Integrated
Security=false;User Id=sa;Password=;" />
<TestGroup>
<utilitySection>
<add key="ApplicationTitle" value="Sample Console Application" />
<add key="ConnectionString"
value="Server=localhost;Database=Taxpayers;
User Id=sa;
Password=DaffyDuck;" />
</utilitySection>
</TestGroup>
<appSettings>
<add key="PromptOnExit" value = "false" />
<add key="MyNameIs" value = "Kevin S. Gallagher" />
<add key="MyAgeIs" value = "49" />
<add key="CheckBox1Checked" value = "true" />
<add key="ComboItems" value =
"Jan,Feb,Mar,Apr,May,June,Jul,Aug,Sep,Oct,Nov,Dec" />
<add key="MyDataBase" value = "NopeIDoNotExist.mdb" />
</appSettings>
</configuration>