string pathToConfig = Directory.GetCurrentDirectory(); // check for the config file if (File.Exists(string.Format(@"{0}\config.xml", pathToConfig))) { Console.WriteLine("Found the config.xml file, reading.."); // load the xml file XmlDocument xmlDoc = new XmlDocument(); XmlTextReader xmlReader = new XmlTextReader(string.Format(@"{0}\config.xml", pathToConfig)); xmlDoc.Load(xmlReader); XmlElement elem = xmlDoc.CreateElement("XPos"); XmlText text = xmlDoc.CreateTextNode("400"); xmlDoc.DocumentElement.AppendChild(elem); xmlDoc.DocumentElement.LastChild.AppendChild(text); Console.WriteLine("Display the modified XML..."); xmlDoc.Save("config.xml"); XmlNodeList nodeList = xmlDoc.ChildNodes[2].ChildNodes[0].ChildNodes; label15.Text = nodeList[0].InnerText.ToString(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)