473,582 Members | 3,083 Online
Bytes | Software Development & Data Engineering Community
+ 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 17450
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 saveconfiguratio n 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
1692
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 rw.WriteConfigInfo("User Modes", chkInvisible.Text, chkInvisible.Checked, "PirateChat.xml") the error occured in hightleighted in below :....... Public Function...
1
2001
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 == 'inline') { icon.src = icon.CollaspedSrc; e.src = e.CollaspedSrc;
3
3717
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> </configuration>
8
4492
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 files like the name of a database or connection string. I have read several articles indicating that .config files are now used, but I am confused...
0
1021
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 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...
3
4429
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 created to the dataset so that when I do use the "WriteXml" method, the generated xml file will be properly formatted to the schema I created. I did...
0
3375
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 within options. I have everything being dynamically named from the previously dynamically named element. (I hope this makes sense.) I am not able to...
0
8159
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7920
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8183
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6569
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5685
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3809
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3835
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1413
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1147
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.