473,385 Members | 2,014 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,385 software developers and data experts.

Config file deletion on Close() with System.Configuration

1
Hi,

Here is my code

Expand|Select|Wrap|Line Numbers
  1.  
  2. class ConfigFile 
  3.     {
  4.         public void AddToConfig(string drive, string path)
  5.         {
  6.            System.Configuration.Configuration config = 
  7.                 ConfigurationManager.OpenExeConfiguration(
  8.                 ConfigurationUserLevel.None);
  9.  
  10.             config.AppSettings.Settings.Add(drive, path);
  11.             config.Save();
  12.         }
  13.  
When I call this method, the file is created and filled correctly.
The file is valid all along the program but is deleted automatically when the program closes.
The only way I found to prevent that is setting the file in read-only before the application closure. Not really clean though...

How can I manage to keep the file after closure?

Thanks ;)
Apr 11 '07 #1
0 761

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: KennethBohman | last post by:
Hi everybody, Question: how can I use the executable.config-files during installation? The answer might seem obvious, but there is apparently more to it! My itention was, as part of the...
1
by: vkrasner | last post by:
It works with VS2003 and does not in VS2005: in VS2003 : string sMyvalue = ConfigurationSettings.AppSettings; in VS2005 (does not work!!) string sMyvalue = ConfigurationManager.AppSettings; ...
2
by: KennethBohman | last post by:
Hi everybody, Question: how can I use the executable.config-files during installation? The answer might seem obvious, but there is apparently more to it! My itention was, as part of the...
0
by: hazz | last post by:
I want to load Service.exe.config into a DataGrid, change the timer interval value from 10000 to 555555, then update the original exe.config. The code below shows the code at step 1 and 2 before...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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
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...

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.