473,396 Members | 2,098 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Comments disappear from appSettings after Save()

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.OpenMappedExeCo nfiguration(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"

Nov 16 '07 #1
9 2343
Antonio Ooi wrote:
Any way to preserve my comments? Thanks!
Upgrade to VB6! ;-)
--
..NET: It's About Trust!
http://vfred.mvps.org
Nov 16 '07 #2
"Antonio Ooi" <an*******@hotmail.comwrote in message
news:C0**********************************@microsof t.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.con trols
microsoft.public.dotnet.framework.adonet
(Note that "vb" is not present in the group name.)
Nov 16 '07 #3
Sorry, hahahahaha...............
"Jeff Johnson" <i.***@enough.spamwrote in message
news:13*************@corp.supernews.com...
"Antonio Ooi" <an*******@hotmail.comwrote in message
news:C0**********************************@microsof t.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.con trols
microsoft.public.dotnet.framework.adonet
(Note that "vb" is not present in the group name.)
Nov 16 '07 #4
"Antonio Ooi" <an*******@hotmail.comwrote in message
news:3D**********************************@microsof t.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.
Nov 16 '07 #5
Jeff Johnson schreef:
"Antonio Ooi" <an*******@hotmail.comwrote in message
news:C0**********************************@microsof t.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
Nov 20 '07 #6

"C-Services Holland b.v." <cs*************@csh4u.nlwrote in message
news:-u******************************@zeelandnet.nl...
Jeff Johnson schreef:
"Antonio Ooi" <an*******@hotmail.comwrote in message
news:C0**********************************@microsof t.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?
Nov 20 '07 #7
NeilH wrote:
>>>
[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

Nov 20 '07 #8
"C-Services Holland b.v." <cs*************@csh4u.nlwrote in message
news:-u******************************@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.
Nov 20 '07 #9
Jeff Johnson schreef:
"C-Services Holland b.v." <cs*************@csh4u.nlwrote in message
news:-u******************************@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
Nov 23 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bil Click | last post by:
I am coding classic ASP pages in Visual Studio .Net 2003. I have a file called counties_option.asp that just has a list of options: <OPTION VALUE="030">ANSON</OPTION> <OPTION...
7
by: Frank Schumacher | last post by:
Hi NG, I have a weird problem, that's starting to get my sanity. My webapplication stores several values in Session. After a server roundtrip, no Session variables exist anymore (Session.Count...
2
by: Jessy Martin | last post by:
what is the syntax for comments in the XML file? I have app.config and would like to write comments for each key value. <?xml version="1.0" encoding="utf-8" ?> <configuration> ...
4
by: Jim in Arizona | last post by:
I've been using VB 2005 for a few years now. My entire coding history is VB related. This weekend I decided to start learning C#. I'm at work now and decided to do some coding in C# that I would...
7
by: moondaddy | last post by:
I'm running a wpf windows app and want to add the appSettings element to the config file. when I do, the app wont start up and I get the following error: {"The type initializer for...
3
by: Mark Rae | last post by:
Hi, Apologies if this is a stupid question, but it's late... I have a C# 2 WinForms project called RTES, and I'm trying to add new key/value pairs to the appSettings section of its config...
3
by: Kurt Jakobsen | last post by:
Hello, Sorry for putting this problem back on the list. I had it previously under another title that now does not describe the real problem. Hopefully the new title will trigger someone that has had...
1
by: Sylvie | last post by:
I am Developing a web application and reading connection strings from Web.Config file, How can I write appSettings keys programmaticaly via a web page ? Thanks <?xml version="1.0"?> ...
0
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi, thanks, mister The code string rutaConfig = tbRutaConfigServicioBase.Text; '// Map to the application configuration file. ExeConfigurationFileMap configFile = New...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.