Hello all so sorry I have been offline for so long.
What have I been up to? Well KJM Solutions site is up and running again (http://www.kjmsolutions.com ). It is a site that will be devoted mostly to development of my own skills but also will offer custom development of .NET software if you should be interested :). Right now just the default page for the provider is there but finding a host and getting it going is a real challenge. I won’t be hosting my own servers anymore and i will miss that but had to make some choices. m6.net is the provider I chose if anyone is interested.
In addition, I am in the process of reforming Jericho, the Christian parody rock band I had in Sheboygan. So that is taking a lot of time. Also playing with some other churches, but really just trying to get in the groove of playing keyboards again after a long time of not playing.
Anyway, today’s topic is writing to a XML file using LINQ. Make it a great day!
Lets say you have a XML file called Settings.xml that looks like this
<?xml version="1.0" encoding="utf-8"?>
<Location>New York City</Location>
<System>Windows 2003 Advance Server</System>
<System>Windows 2005 Server</System>
The following code will open the XML file and add a Host node with children to the end of the Host node list.
Dim xml As XDocument = XDocument.Load("Settings.xml")
Dim Network As XElement = xml.Root
Dim newHost As New XElement("Host", New XAttribute("url", txtURL.Text), _
New XElement("Location", txtLocation.Text), _
New XElement("Administrator", txtAdministrator.Text), _
New XElement("System", txtSystem.Text))
If you want to load it to the very first node just after Network node then replace this line of code:
With this line of code: