I want to dynamically create XML file with nodes of the all TextBoxes in the form with theirs values.
Example:
var xmlNode =
new XElement("TextBoxes",
new XElement("TextBox",
new XElement("name", textBox1.Name.ToString())
)
I've tried:
foreach (TextBox text in this.Controls.OfType<TextBox>())
{
var xmlNode =
new XElement("TextBoxes",
new XElement("TextBox",
new XElement("name", text.Name.ToString())
)
);
xmlNode.Save("Test.xml");
}
Any suggestions?