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

Home Posts Topics Members FAQ

Writing and Retrieving Configuration from an XML Document in C#

J-S
Hi,

I'm a student and new to the .net framework. What is the best way to save
configuration properties (not user specific) for a C# application? I read a
few messages talking about using XML to save properties. I read about using
app.config, but it seems you have to manually edit the file in order to
change its values, and I don't want those values hard coded. I'm trying to
avoid the registry. In my reading I have concluded that using an XML file
would have more advantages over using the registry, .ini or .dat file.

In my application I have a few textboxes, and every time this application is
opened I would like it to remember what the last user wrote. How can I
implement this using XML? Are there any good and simple examples about
creating an XML document and then reading/writing to it in C#?

Thanks a lot,

J-S.

Nov 12 '05 #1
1 17438
Hi,

I wrote some how to's about XML.

How to create a new xml file with XmlDocument:
http://weblogs.asp.net/sonukapoor/articles/132945.aspx

How to read an xml file using XmlTextReader:
http://weblogs.asp.net/sonukapoor/articles/132818.aspx

Also take a look at my other xml how to's:
http://weblogs.asp.net/sonukapoor/category/5175.aspx

Sonu
[My Blog:] http://weblogs.asp.net/sonukapoor/

-----Original Message-----
Hi,

I'm a student and new to the .net framework. What is the best way to saveconfiguration properties (not user specific) for a C# application? I read afew messages talking about using XML to save properties. I read about usingapp.config, but it seems you have to manually edit the file in order tochange its values, and I don't want those values hard coded. I'm trying toavoid the registry. In my reading I have concluded that using an XML filewould have more advantages over using the registry, .ini or .dat file.
In my application I have a few textboxes, and every time this application isopened I would like it to remember what the last user wrote. How can Iimplement this using XML? Are there any good and simple examples aboutcreating an XML document and then reading/writing to it in C#?
Thanks a lot,

J-S.

.

Nov 12 '05 #2

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

Similar topics

1
by: Supra | last post by:
i got "system error" when saving to xml file. i am using checkbox1 control to xml. when user clicked checkbox and set to true and press btnOk to conform and save it to xml ...
1
by: sun | last post by:
In Javascript, I write to document.cookie, and retrieve it in server side. It's in a treenode control, when the node is expanded, I write document.cookie: if(subTree.style.display ==...
3
by: Raj Kumar | last post by:
Hi! I have a text file that looks like this: <configuration> <appSettings> <add key="db_server" value="someserver" /> <add key="db_database" value="somedatabase" /> </appSettings>...
8
by: Steve | last post by:
Can anyone tell me the preferred method for writing and retrieving persistent information using .Net. Specifically, I am referring to information that you used to see in registry keys or .ini...
0
by: J-S | last post by:
Hi, I'm a student and new to the .net framework. What is the best way to save configuration properties (not user specific) for a C# application? I read a few messages talking about using...
3
by: Eric | last post by:
Help! I created a XML schema with a Visual Studio tools. I'm filling a dataset with a DataAdapter. Before I use the "WriteXml" method to write the data to a xml file, I want to map the XSD file I...
0
bmallett
by: bmallett | last post by:
First off, i would like to thank everyone for any and all help with this. That being said, I am having a problem retrieving/posting my dynamic form data. I have a form that has multiple options...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
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: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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.