Hello,
When I open my app an XML doc is created with several elements giving to each of them the value 0. After the XML is created I want that several labels on the form to change their text to spcific elements' values (in this case 0). Is there any way to that? I'm using labels because they fit my needs... I don't know if there is another control that can be used better.
private void createXMLdoc()
{
XmlDocument mainDoc = new XmlDocument();
XmlDeclaration mainDocDec = mainDoc.CreateXmlDeclaration("1.0", null, null);
mainDoc.AppendChild(mainDocDec);
XmlElement root = mainDoc.CreateElement("AllTimeElements");
mainDoc.AppendChild(root);
XmlElement X1 = mainDoc.CreateElement("X1");
X1.InnerText = "0";
root.AppendChild(X1);
XmlElement X2= mainDoc.CreateElement("X2");
X2.InnerText = "0";
root.AppendChild(X2);
XmlElement X3= mainDoc.CreateElement("X3");
X3.InnerText = "0";
root.AppendChild(X3);
XmlElement X4= mainDoc.CreateElement("X4");
X4.InnerText = "0";
root.AppendChild(X4);
XmlElement X5= mainDoc.CreateElement("X5");
X5.InnerText = "0";
root.AppendChild(X5);
XmlElement X6= mainDoc.CreateElement("X6");
X6.InnerText = "0";
root.AppendChild(X6);
XmlElement X7= mainDoc.CreateElement("X7");
X7.InnerText = "0";
root.AppendChild(X7);
XmlElement X8= mainDoc.CreateElement("X8");
X8.InnerText = "0";
root.AppendChild(X8);
XmlElement X9= mainDoc.CreateElement("X9");
X9.InnerText = "0";
root.AppendChild(X9);
XmlElement X10= mainDoc.CreateElement("X10");
X10.InnerText = "0";
root.AppendChild(X10);
XmlElement X11= mainDoc.CreateElement("X11");
X11.InnerText = "0";
root.AppendChild(X11);
XmlElement X12= mainDoc.CreateElement("X12");
X12.InnerText = "0";
root.AppendChild(X12);
XmlElement X13= mainDoc.CreateElement("X13");
X13.InnerText = "0";
root.AppendChild(X13);
mainDoc.Save(@"C:\\Windows\Temp\SessionsTotal.xml");
}
private void displayXMLdoc()
{
XmlDocument mainDisplay = new XmlDocument();
mainDisplay.Load(@"C:\\Windows\Temp\SessionsTotal.xml");
//here goes code to display the elements' values
}