473,473 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Configuration file

Hello everyone,

I m trying to use the ConfigurationManager class to store and retrieve
configuration data for my application.

My piece of code can create, write and read data from the file but when my
application close, the configuration file disappear.
In fact, when I use the "debug" to launch and test my application the
app.exe.config is created and when the application finish, the file is
deleted.
When I try to generate the application, the app.exe.config isn't created too.

How can I do to create this file and to keep it not deleted?

Here what I m using:

Public Shared Sub Write(ByVal entry As String, ByVal value As String)
Try

Dim Config As Configuration =
ConfigurationManager.OpenExeConfiguration(Configur ationUserLevel.None)

Config.AppSettings.Settings.Add(entry, value)
Config.AppSettings.Settings.Item(entry).Value = value
Config.Save(ConfigurationSaveMode.Modified)
ConfigurationManager.RefreshSection("appSettings")

Catch ex As Exception
MsgBox(ex.ToString())
End Try

End Sub

Thanks a lot or your answers.
Aug 8 '06 #1
3 1340
I m trying to use the ConfigurationManager class to store and retrieve
configuration data for my application.

My piece of code can create, write and read data from the file but when my
application close, the configuration file disappear.
In fact, when I use the "debug" to launch and test my application the
app.exe.config is created and when the application finish, the file is
deleted.
When I try to generate the application, the app.exe.config isn't created too.

How can I do to create this file and to keep it not deleted?
Do you have an App.Config file added to your project? If you are creating it
on the fly when the app runs then perhaps it is automatically deleted. Add an
application configuration file to your project at design time and see if that
works.
Aug 8 '06 #2
Thanks for answering.

I don't see any application configuration file I can add to my project at
design. Are ou sure we can add a configuration file at design? Is it a
compenent that I have to add to the list of design compenent?

works.
"Leon Mayne" wrote:
I m trying to use the ConfigurationManager class to store and retrieve
configuration data for my application.

My piece of code can create, write and read data from the file but when my
application close, the configuration file disappear.
In fact, when I use the "debug" to launch and test my application the
app.exe.config is created and when the application finish, the file is
deleted.
When I try to generate the application, the app.exe.config isn't created too.

How can I do to create this file and to keep it not deleted?

Do you have an App.Config file added to your project? If you are creating it
on the fly when the app runs then perhaps it is automatically deleted. Add an
application configuration file to your project at design time and see if that
works.
Aug 9 '06 #3
I don't see any application configuration file I can add to my project at
design. Are ou sure we can add a configuration file at design? Is it a
compenent that I have to add to the list of design compenent?
Right-click your project in solution explorer, select Add / Add new item,
and select Application Configuration File
Aug 9 '06 #4

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

Similar topics

2
by: Alexander Kienzle | last post by:
I'm new to Java programming. I'm developing a Servlet for tomcat which needs an external configuration file. With external I mean a file (in XML format) which is customizable and not contained in...
2
by: kathy | last post by:
What Application Configuration File is? And when/where/how to use it? Any documents on that? MSDN has somrthings scatter everywhere - hard to follow. thanks,
4
by: Jessard | last post by:
Hi Guys and Girls, I have a situation where I am wishing to deploy a .NET dll onto a number of servers. The classes in the DLL will be used by VBScripts. When one of the classes - Connection -...
3
by: Florida Coder | last post by:
I have the need to store some application specific configuration data to be used by a class library and or a windows service. I would like to do this in a fashion similar to the way we do with...
0
by: phillip | last post by:
This is interesting, I have attached my web.config file and the exception I have been logging. I created a library which provide data access to a database and a control system. The library is...
1
by: Ramanfromoz | last post by:
Hi, Developing a new we application. Everything okay on my local WIN XP PROFESSIONAL, IIS 5.0 running locally. The website is running smoothly. Now, the same code I am copying over to a...
10
by: Rider | last post by:
Hi, simple(?) question about asp.net configuration.. I've installed ASP.NET 2.0 QuickStart Sample successfully. But, When I'm first start application the follow message shown. ========= Server...
0
by: sean rogers | last post by:
hello im using the configuration block and have created the main config file for the application - the file that contains the paths to the other configuration sections i.e. - (my other...
6
by: Jeff Hegedus | last post by:
I have a dll that requires some configuration data. I put the configuration data in a custom configuration section in a config file that is loaded in the installation folder of the dll. If I...
3
by: Mike | last post by:
Hi I have problem as folow: Caught Exception: System.Configuration.ConfigurationErrorsException: An error occurred loading a configuration file: Request for the permission of type...
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
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
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
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
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...
1
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...
0
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...
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.