473,408 Members | 1,753 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,408 software developers and data experts.

Re: Modify app.config in VB.NET

I think you are running your code from VS. Just run the exe from outside and
it will work.
Thanks,
Levent Dagistanli

"Andrew" wrote:
Hi,

I've tried the code out with reference from msdn and I've got the same
problem as well.

When going thru the stepbystep debugger, I can see the values being added to
the ConfigurationManager, but somehow the values are not being save to the
app.config file.

eg.

using System.Configuration;

ConfigurationSection section =
(ConfigurationSection)config.GetSection("appSettin gs");

//Read the key in the app.config file
AppSettingsSection assection = config.AppSettings;
string str = assection.Settings["aaa"].Value.ToString();

// Add an Application Setting.
config.AppSettings.Settings.Add(asName, "test_value");

// Save the configuration file.
config.Save(ConfigurationSaveMode.Modified);

// Force a reload of a changed section.
ConfigurationManager.RefreshSection("appSettings") ;

Is there an error in my code ? Any feedback is appreciated.

cheers,
Andrew
Jun 27 '08 #1
1 3229
"Levent Dagistanli" <Levent Da********@discussions.microsoft.comwrote in
message news:58**********************************@microsof t.com...
>I think you are running your code from VS. Just run the exe from outside
and
it will work.
I don't know whether anyone from Microsoft regularly reads the Visual Basic
groups but if they do then I am very surprised that they permit one of their
own MVPs to engage in such outrageous long term trolling activities in one
of their own public newsgroups, such as the activity that the person who
purports to be Bill McCarthy has engaged in on the
microsoft.public.vb.general.discussion group for many months. If this man
belongs to you:

https://mvp.support.microsoft.com/pr...9-25680609CCB8

.. . . then perhaps you might like to look at his activity in that group.
Here for example is one of his very latest offerings:

"Bill McCarthy" <Bi**@N0SPAM.comwrote in message
news:19**********************************@microsof t.com...
Yeh, still a way to go. I think given the warm reaction today,
and given some folks have learning difficulties around here
(obviously why they are still *stuck* in VB6 *only*), might
just have to ramp things up a notch or two, and make it more
toasty :D


Jun 27 '08 #2

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

Similar topics

1
by: justin | last post by:
I have the problem that I need to programatically add new url mappings to the web.config file in an asp 2.0 app. e.g. my code is Dim urlMappings As UrlMappingCollection =...
5
by: Alberto | last post by:
I need to modify a value in the app.config file with this code: System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); string key =...
1
by: =?Utf-8?B?Q2h1Y2sgUA==?= | last post by:
I have an asp.net solution with a web deployment project. When we try to build/debug, we get the message: An editor or project is attempting to check out a file that is modified in memory,...
1
by: dhochee | last post by:
I understand that settings stored in the app.exe.config file and accessed via Properties.Settings.Default are only available within an app domain, but I'm confused about the best way to handle...
3
by: Jeff | last post by:
I have a solution with two projects. Project A is the startup project, while Project B serves as the project with the data logic. At run time, the first thing I need to do is write to Project...
0
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi misters, i have an app.config of my App that uses WCF. I need change the configuration servicemodel, and I want update somes values.
6
by: Ramesh | last post by:
Hello, I am using the ofstream class to create a text file with keys and values like: Key1=Value10 Key2=Value15 Key3=Value20 In case I need to set a new value for Key2, say value50 - I am...
0
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi all I have an app.config file for my App, and use MailSettings Section. I can modify AppSettings and ConnectionsStrings , and then save app.config.
4
by: pasam | last post by:
Hi I am creating installer for asp.net i am using this code for to modify web.config file but i cant whats wrong this code ' Get configuration. Dim config As Configuration =...
5
by: ziycon | last post by:
I have two PHP files, modify.php & config.php, I have the below code in config.php and I'm wondering how I would go about searching config.php from modify.php and changing the values in config.php? ...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
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...
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
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...
0
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...

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.