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

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 17436
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.