Re: Reading a <sectionGroup> in app.config
- From: "kevininstructor@xxxxxxxxxxx" <Kevin.S.Gallagher@xxxxxxxxxxx>
- Date: Fri, 6 Jan 2006 07:43:26 -0800
Yes, here are my imports
Imports System.Configuration
Imports System.Collections.Specialized
"Mike Miller" <MikeMiller@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:07ED2606-5131-445E-B873-207CD6D6E7AA@xxxxxxxxxxxxxxxx
> Are you referencing the System.Configuration dll? Just another off the
> top
> of my head thought.
>
> "kevininstructor@xxxxxxxxxxx" wrote:
>
>> Okay, as mentioned before, this code is unaltered code copied and pasted
>> from
>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpcondeclaringsectiongroups.asp
>> and placed into a) app.config b) a button Click event to trigger the
>> code.
>> My logic was to not alter any of the MSDN code until it worked. Also, I
>> placed this code presented below from MSDN into a new Windows forms
>> project
>> so there is nothing to conflict with the code from MSDN. Please note my
>> problem is with the read from <sectionGroup name="mySectionGroup">.
>>
>> Thanks for your time on this matter
>>
>>
>> <configuration>
>> <configSections>
>> <section name="sampleSection"
>> type="System.Configuration.SingleTagSectionHandler" />
>> <!--The following code declares a section group called
>> mySectionGroup. -->
>> <sectionGroup name="mySectionGroup">
>> <section name="mySection"
>> type="System.Configuration.NameValueSectionHandler,System"
>> />
>> </sectionGroup>
>> </configSections>
>>
>> <mySectionGroup>
>> <mySection>
>> <add key="key1" value="value1" />
>> </mySection>
>> </mySectionGroup>
>>
>> </configuration>Dim nvc As NameValueCollection
>>
>> ' Notice the path-like syntax.
>> nvc = CType(ConfigurationSettings.GetConfig("mySectionGroup/mySection"),
>> NameValueCollection)
>>
>>
>> "Kevin Spencer" <kevin@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:OTKXJ4sEGHA.3984@xxxxxxxxxxxxxxxxxxxxxxx
>> > Well, at this point I can't say without seeing the code you're working
>> > from. Can you post it?
>> >
>> > --
>> > HTH,
>> >
>> > Kevin Spencer
>> > Microsoft MVP
>> > .Net Developer
>> > You can lead a fish to a bicycle,
>> > but it takes a very long time,
>> > and the bicycle has to *want* to change.
>> >
>> > "kevininstructor@xxxxxxxxxxx" <Kevin.S.Gallagher@xxxxxxxxxxx> wrote in
>> > message news:%23vnq8HsEGHA.3984@xxxxxxxxxxxxxxxxxxxxxxx
>> >>I am using the exact code without any modifications from the example in
>> >>the webpage from Microsoft below. Figured if the example worked then
>> >>the
>> >>next step would be to modify it for my use but have only copied and
>> >>pasted
>> >>the code so far.
>> >>
>> >>
>> >> "Mike Miller" <MikeMiller@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> >> news:90AC9DB3-B53E-41FA-8338-848D024C1608@xxxxxxxxxxxxxxxx
>> >>> Are you declaring the custom section in the <configSections>? I find
>> >>> that is
>> >>> often an easy one to forget.
>> >>>
>> >>> "kevininstructor@xxxxxxxxxxx" wrote:
>> >>>
>> >>>> I have been trying to get the code at the page below to work in .NET
>> >>>> 1.1 but
>> >>>> can not seem to get the example to work in VB.NET, any ideas what
>> >>>> might
>> >>>> be
>> >>>> the problem?
>> >>>>
>> >>>> <a
>> >>>> href="http://msdn.microsoft.com/library/en-us/cpguide/html/cpcondeclaringsectiongroups.asp?frame=true">Declaring
>> >>>> and Accessing Section Groups (.NET Framework Developer's Guide)</a>
>> >>>>
>> >>>> Note: I posted under microsoft.public.dotnet.language.vb with no
>> >>>> luck
>> >>>> so I
>> >>>> am now trying this forum.
>> >>>>
>> >>>> Thanks for any thoughts,
>> >>>> Kevin
>> >>>>
>> >>>>
>> >>>>
>> >>
>> >>
>> >
>> >
>>
>>
>>
.
- Follow-Ups:
- Re: Reading a <sectionGroup> in app.config
- From: Mike Miller
- Re: Reading a <sectionGroup> in app.config
- References:
- Reading a <sectionGroup> in app.config
- From: kevininstructor@xxxxxxxxxxx
- Re: Reading a <sectionGroup> in app.config
- From: kevininstructor@xxxxxxxxxxx
- Re: Reading a <sectionGroup> in app.config
- From: Kevin Spencer
- Re: Reading a <sectionGroup> in app.config
- From: kevininstructor@xxxxxxxxxxx
- Re: Reading a <sectionGroup> in app.config
- From: Mike Miller
- Reading a <sectionGroup> in app.config
- Prev by Date: Re: MSI-
- Next by Date: Re: Reading a <sectionGroup> in app.config
- Previous by thread: Re: Reading a <sectionGroup> in app.config
- Next by thread: Re: Reading a <sectionGroup> in app.config
- Index(es):