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

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 1336
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
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.