473,606 Members | 2,200 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.E xeConfiguration FileMap()

fileMap.ExeConf igFilename = "MyApp.exe.conf ig"

Dim appConfig As Configuration.C onfiguration = Configuration.C onfigurationMan ager.OpenMapped ExeConfiguratio n(fileMap, Configuration.C onfigurationUse rLevel.None)

With appConfig.AppSe ttings

.Settings("MyKe y1").Value = "10"

.Settings("MyKe y2").Value = "20"

End With

appConfig.Save( Configuration.C onfigurationSav eMode.Minimal)

Any way to preserve my comments? Thanks!


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

Nov 16 '07 #1
9 2355
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*******@hotm ail.comwrote in message
news:C0******** *************** ***********@mic rosoft.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.microsof t.com.

For questions specific to the VB.NET language, use this group:
microsoft.publi c.dotnet.langua ges.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.publi c.dotnet.framew ork.windowsform s.controls
microsoft.publi c.dotnet.framew ork.adonet
(Note that "vb" is not present in the group name.)
Nov 16 '07 #3
Sorry, hahahahaha..... ..........
"Jeff Johnson" <i.***@enough.s pamwrote in message
news:13******** *****@corp.supe rnews.com...
"Antonio Ooi" <an*******@hotm ail.comwrote in message
news:C0******** *************** ***********@mic rosoft.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.microsof t.com.

For questions specific to the VB.NET language, use this group:
microsoft.publi c.dotnet.langua ges.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.publi c.dotnet.framew ork.windowsform s.controls
microsoft.publi c.dotnet.framew ork.adonet
(Note that "vb" is not present in the group name.)
Nov 16 '07 #4
"Antonio Ooi" <an*******@hotm ail.comwrote in message
news:3D******** *************** ***********@mic rosoft.com...
Sorry, hahahahaha..... ..........
I didn't notice the crosspost. Specifically,
microsoft.publi c.vb.general.di scussion is a VB6 group.
dotnet.language s.vb is definitely a good place to ask.
Nov 16 '07 #5
Jeff Johnson schreef:
"Antonio Ooi" <an*******@hotm ail.comwrote in message
news:C0******** *************** ***********@mic rosoft.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*******@hotm ail.comwrote in message
news:C0******** *************** ***********@mic rosoft.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.publi c.dotnet.langua ges.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
1748
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 VALUE="040">ASHE</OPTION> etc... I then call this as an include file in several places in a file called page1.asp like this:
7
2070
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 is 0) I have logged the Session.SessionID, it is the same as before. I have logged the last and the first line of code in my Codebehind. When
2
33176
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> <appSettings>
4
10964
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 normally do in VB. I'm running into various 'small' difficulties. I don't understand this: In vb, this is valid:
7
11102
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 'System.Windows.Application' threw an exception."} {"The type initializer for 'System.Windows.Navigation.BaseUriHelper' threw an exception."} " at System.Windows.Application..ctor()\r\n at DiagramTool_v1.App..ctor()\r\n at DiagramTool_v1.App.Main() in
3
4350
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 file. I'm using the code here: http://www.codeproject.com/useritems/SystemConfiguration.asp?msg=1971660 as an example.
3
6951
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 the same problem to respond... The problem: When I want to select page 2 in my grid view control, the grid view disappear. After some trail and error (with good help from others on this network) it seems like the problem appears when the...
1
4584
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"?> <configuration>
0
2615
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 ExeConfigurationFileMap();
0
7951
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8439
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8430
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8094
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8305
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6770
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5966
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3930
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2448
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.