467,145 Members | 1,056 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,145 developers. It's quick & easy.

Config.xml file read and write ?

i have a setting form for my program and wish to allow the setting to
be saved and reopened to the last set setting on program startup..
lets say i have a xml file like this :

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="test" value="My Test String"
/>
</appSettings>
</configuration>

[code:1:9a6bbbbeac]

private void button1_Click(object sender, System.EventArgs e)
{

//here i put what code ??

}

[/code:1:9a6bbbbeac]

how do a get the app to save any new settings to this xml file and
also how do i load the setting on program startup ?

Thanks

MrXs

Nov 16 '05 #1
  • viewed: 5137
Share:
1 Reply
In your config file,specify the name of a seperate settings file (or use a
default name). If the app is run by multiple users, and they each need
their own settings, make sure you store the settings file in their local
"Documents and Settings" folder, and not in the app directory.

Have your app deserialize the setting file when you start up, and
reserialize it when you shut down. XML of course.

Let the config file be application config, not user settings. Most .NET
apps do this or a form of this for storing settings, rather than changing
the config file itself.

--- Nick

"MrXs" <Mr******@hotmail-dot-com.no-spam.invalid> wrote in message
news:41**********@Usenet.com...
i have a setting form for my program and wish to allow the setting to
be saved and reopened to the last set setting on program startup..
lets say i have a xml file like this :

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="test" value="My Test String"
/>
</appSettings>
</configuration>

[code:1:9a6bbbbeac]

private void button1_Click(object sender, System.EventArgs e)
{

//here i put what code ??

}

[/code:1:9a6bbbbeac]

how do a get the app to save any new settings to this xml file and
also how do i load the setting on program startup ?

Thanks

MrXs

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Maxim Khesin | last post: by
4 posts views Thread by V.Boomessh | last post: by
4 posts views Thread by UJ | last post: by
3 posts views Thread by Simon Harvey | last post: by
1 post views Thread by vkrasner | last post: by
16 posts views Thread by Timm | last post: by
17 posts views Thread by Fred Nelson | last post: by
11 posts views Thread by TARUN | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.