PC Review


Reply
 
 
=?Utf-8?B?Y2FzaGRlc2ttYWM=?=
Guest
Posts: n/a
 
      5th Sep 2006
I can retrieve a value from the appSettings section of my app.config file for
a Windows application (VS 2003) but is there a way to write to this file,
updating a value?

I want to store a value which may increment from time to time, and need the
value to be retained between closing the application and starting it again.

Or should I just write it to a normal text file instead?
 
Reply With Quote
 
 
 
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      5th Sep 2006
My general rule of thumb for app config files is to store values in
there that will be constant throughout the lifetime of an instance of the
app running. If something is bound to change during the course of the app,
then this is not the place to put it.

In .NET 1.1 and before, you had to load the config file with the Xml
classes and modify the file yourself.

In .NET 2.0 and above, you can use the classes in the
System.Configuration namespace to modify certain values and to save them
back to the config file.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (E-Mail Removed)

"cashdeskmac" <(E-Mail Removed)> wrote in message
news:9A1305C9-9F57-4BF5-A01A-(E-Mail Removed)...
>I can retrieve a value from the appSettings section of my app.config file
>for
> a Windows application (VS 2003) but is there a way to write to this file,
> updating a value?
>
> I want to store a value which may increment from time to time, and need
> the
> value to be retained between closing the application and starting it
> again.
>
> Or should I just write it to a normal text file instead?



 
Reply With Quote
 
jibesh
Guest
Posts: n/a
 
      6th Sep 2006
why dont you think of a Singleton class contains a HashTable, and Create a
XML schema ,
read and write your data anywhere from your application

- Jibesh.V.P


"cashdeskmac" <(E-Mail Removed)> wrote in message
news:9A1305C9-9F57-4BF5-A01A-(E-Mail Removed)...
> I can retrieve a value from the appSettings section of my app.config file

for
> a Windows application (VS 2003) but is there a way to write to this file,
> updating a value?
>
> I want to store a value which may increment from time to time, and need

the
> value to be retained between closing the application and starting it

again.
>
> Or should I just write it to a normal text file instead?



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
appsettings Mark Microsoft ASP .NET 2 2nd Feb 2006 08:41 PM
AppSettings INeedADip Microsoft C# .NET 1 15th Jan 2006 12:35 AM
"Unrecognized configuration section appsettings" exception thrown - Configuration.Appsettings(key) hazz Microsoft C# .NET 2 11th Jun 2004 10:54 PM
AppSettings lobrys Microsoft Dot NET 2 2nd Jun 2004 04:29 PM
<appsettings> Kenneth Microsoft ASP .NET 2 20th Aug 2003 02:15 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:44 PM.