Home All Groups Group Topic Archive Search About

Comments disappear from appSettings after Save()

Author
16 Nov 2007 6:01 PM
Antonio Ooi
Hi,

I have the following appSettings in my app.config file:

  <appSettings>

      <!-- Some comments here -->

      <add key="MyKey1" value="1"/>

      <!-- Some comments here -->

      <add key="MyKey2" value="2"/>

  </appSettings>



After issuing the Save method as shown below, all comments under my appSettings section are gone:



        Dim fileMap As New Configuration.ExeConfigurationFileMap()

        fileMap.ExeConfigFilename = "MyApp.exe.config"

        Dim appConfig As Configuration.Configuration = Configuration.ConfigurationManager.OpenMappedExeConfiguration(fileMap, Configuration.ConfigurationUserLevel.None)

        With appConfig.AppSettings

            .Settings("MyKey1").Value = "10"

            .Settings("MyKey2").Value = "20"

        End With



        appConfig.Save(Configuration.ConfigurationSaveMode.Minimal)



Any way to preserve my comments? Thanks!




--
Regards,
Antonio Ooi
"Everyone dies, not everyone really lives"

Author
16 Nov 2007 6:19 PM
Karl E. Peterson
Antonio Ooi wrote:
> Any way to preserve my comments? Thanks!

Upgrade to VB6!  ;-)
--
..NET: It's About Trust!
http://vfred.mvps.org
Author
16 Nov 2007 6:26 PM
Jeff Johnson
"Antonio Ooi" <antoni***@hotmail.com> wrote in message
news:C07EB3A1-0D5F-42D0-92A7-AC2B6FC1A64A@microsoft.com...

> I have the following appSettings in my app.config file:

[Canned response]
This is a VB "classic" newsgroup. Questions about VB.NET (including VB 2005
and VB Express, which have dropped .NET from their names) are off-topic
here.

Please ask .NET questions in newsgroups with "dotnet" in their names. The
*.vb.* groups are for VB6 and earlier. If you don't see the *.dotnet.*
groups on your news server, connect directly to the Microsoft server:
msnews.microsoft.com.

For questions specific to the VB.NET language, use this group:
microsoft.public.dotnet.languages.vb

Please note that things like controls and data access, which have their own
subgroups in the Classic VB hierarchy, are not language-specific in .NET, so
you should look for groups like these:
microsoft.public.dotnet.framework.windowsforms.controls
microsoft.public.dotnet.framework.adonet
(Note that "vb" is not present in the group name.)
Author
16 Nov 2007 6:30 PM
Antonio Ooi
Sorry, hahahahaha...............


Show quote
"Jeff Johnson" <i.get@enough.spam> wrote in message
news:13jro6isb7nn801@corp.supernews.com...
> "Antonio Ooi" <antoni***@hotmail.com> wrote in message
> news:C07EB3A1-0D5F-42D0-92A7-AC2B6FC1A64A@microsoft.com...
>
>> I have the following appSettings in my app.config file:
>
> [Canned response]
> This is a VB "classic" newsgroup. Questions about VB.NET (including VB
> 2005 and VB Express, which have dropped .NET from their names) are
> off-topic here.
>
> Please ask .NET questions in newsgroups with "dotnet" in their names. The
> *.vb.* groups are for VB6 and earlier. If you don't see the *.dotnet.*
> groups on your news server, connect directly to the Microsoft server:
> msnews.microsoft.com.
>
> For questions specific to the VB.NET language, use this group:
> microsoft.public.dotnet.languages.vb
>
> Please note that things like controls and data access, which have their
> own subgroups in the Classic VB hierarchy, are not language-specific in
> .NET, so you should look for groups like these:
> microsoft.public.dotnet.framework.windowsforms.controls
> microsoft.public.dotnet.framework.adonet
> (Note that "vb" is not present in the group name.)
>
Author
16 Nov 2007 9:40 PM
Jeff Johnson
"Antonio Ooi" <antoni***@hotmail.com> wrote in message
news:3DC56E83-33A9-4706-8994-C8EA4D6754F3@microsoft.com...

> Sorry, hahahahaha...............

I didn't notice the crosspost. Specifically,
microsoft.public.vb.general.discussion is a VB6 group.
dotnet.languages.vb is definitely a good place to ask.
Author
16 Nov 2007 6:36 PM
Karl E. Peterson
Jeff Johnson wrote:
> "Antonio Ooi" <antoni***@hotmail.com> wrote in message
> news:C07EB3A1-0D5F-42D0-92A7-AC2B6FC1A64A@microsoft.com...
>
>> I have the following appSettings in my app.config file:
>
> [Canned response]
> This is a VB "classic" newsgroup.

Since the original was actually cross-posted, I couldn't resist stealing Mike's
classic line! <eg>
--
..NET: It's About Trust!
http://vfred.mvps.org
Author
16 Nov 2007 10:02 PM
Jeff Johnson
"Karl E. Peterson" <k***@mvps.org> wrote in message
news:ec$Ik%23HKIHA.4272@TK2MSFTNGP05.phx.gbl...

>> [Canned response]
>> This is a VB "classic" newsgroup.
>
> Since the original was actually cross-posted, I couldn't resist stealing
> Mike's classic line! <eg>

Whoops!! Didn't notice that. I usually use the "Please don't crosspost"
version then.
Author
16 Nov 2007 10:25 PM
Karl E. Peterson
Jeff Johnson wrote:
> "Karl E. Peterson" <k***@mvps.org> wrote ...
>
>>> [Canned response]
>>> This is a VB "classic" newsgroup.
>>
>> Since the original was actually cross-posted, I couldn't resist stealing
>> Mike's classic line! <eg>
>
> Whoops!! Didn't notice that. I usually use the "Please don't crosspost"
> version then.

Whereas I just get all the more likely to climb the soapbox... <g>
--
..NET: It's About Trust!
http://vfred.mvps.org
Author
20 Nov 2007 12:51 PM
C-Services Holland b.v.
Jeff Johnson schreef:
> "Antonio Ooi" <antoni***@hotmail.com> wrote in message
> news:C07EB3A1-0D5F-42D0-92A7-AC2B6FC1A64A@microsoft.com...
>
>> I have the following appSettings in my app.config file:
>
> [Canned response]
> This is a VB "classic" newsgroup. Questions about VB.NET (including VB 2005
> and VB Express, which have dropped .NET from their names) are off-topic
> here.

Please note that the message was posted to several groups, including a
..NET group. Check that first before you post a canned response.


--
Rinze van Huizen
C-Services Holland b.v
Author
20 Nov 2007 1:25 PM
NeilH
Show quote
"C-Services Holland b.v." <cshNOSPAMPLEASE@csh4u.nl> wrote in message
news:-uWdnUfY-M5HSt_anZ2dnUVZ8tvinZ2d@zeelandnet.nl...
> Jeff Johnson schreef:
> > "Antonio Ooi" <antoni***@hotmail.com> wrote in message
> > news:C07EB3A1-0D5F-42D0-92A7-AC2B6FC1A64A@microsoft.com...
> >
> >> I have the following appSettings in my app.config file:
> >
> > [Canned response]
> > This is a VB "classic" newsgroup. Questions about VB.NET (including VB
2005
> > and VB Express, which have dropped .NET from their names) are off-topic
> > here.
>
> Please note that the message was posted to several groups, including a
> .NET group. Check that first before you post a canned response.
>
>
> --
> Rinze van Huizen
> C-Services Holland b.v

Why?
Does it not apply when posted in several groups!
How would YOU recommend informing the original person that they are asking
in the wrong place?
Author
20 Nov 2007 2:22 PM
Jim Mack
NeilH wrote:
Show quote
>>>
>>> [Canned response]
>>> This is a VB "classic" newsgroup. Questions about VB.NET
>>> (including VB 2005 and VB Express, which have dropped .NET from
>>> their names) are off-topic here.
>>
>> Please note that the message was posted to several groups,
>> including a .NET group. Check that first before you post a canned
>> response.
>
> Why?
> Does it not apply when posted in several groups!
> How would YOU recommend informing the original person that they are
> asking in the wrong place?

By mentioning specifically which group is inappropriate, and asking
them to trim it from the list when replying. You can also set
followups to the most appropriate group.

For example, please trim microsoft.public.dotnet.languages.vb when
replying to this (-:

--
        Jim
Author
20 Nov 2007 2:29 PM
Jeff Johnson
"C-Services Holland b.v." <cshNOSPAMPLEASE@csh4u.nl> wrote in message
news:-uWdnUfY-M5HSt_anZ2dnUVZ8tvinZ2d@zeelandnet.nl...

>>> I have the following appSettings in my app.config file:
>>
>> [Canned response]
>> This is a VB "classic" newsgroup. Questions about VB.NET (including VB
>> 2005 and VB Express, which have dropped .NET from their names) are
>> off-topic here.
>
> Please note that the message was posted to several groups, including a
> .NET group. Check that first before you post a canned response.

Please note that FOUR DAYS AGO I noticed this and posted a follow-up
message. Check that first before you post a bitchy response.
Author
23 Nov 2007 4:02 PM
C-Services Holland b.v.
Jeff Johnson schreef:
Show quote
> "C-Services Holland b.v." <cshNOSPAMPLEASE@csh4u.nl> wrote in message
> news:-uWdnUfY-M5HSt_anZ2dnUVZ8tvinZ2d@zeelandnet.nl...
>
>>>> I have the following appSettings in my app.config file:
>>> [Canned response]
>>> This is a VB "classic" newsgroup. Questions about VB.NET (including VB
>>> 2005 and VB Express, which have dropped .NET from their names) are
>>> off-topic here.
>> Please note that the message was posted to several groups, including a
>> .NET group. Check that first before you post a canned response.
>
> Please note that FOUR DAYS AGO I noticed this and posted a follow-up
> message. Check that first before you post a bitchy response.
>
>

Well, you posted a bitchy canned response. So now you know how it feels ;)


--
Rinze van Huizen
C-Services Holland b.v

AddThis Social Bookmark Button