Hi,
I need to store the size of my form in a config file. I was saving
this in the registry, but I need it in a config file now.
I came up with the following code. The part I'm not so sure about is
where I call form.Height.ToString(). Should I be making use of some
better built-in serialization capability? When I was usind the
registry I was using TypeConverter to change things like Size,
Location, BackgroundColor, etc. to strings. Is this the right way to
do this in XML?
Thanks,
John
System.Xml.XmlDocument d = new System.Xml.XmlDocument();
d.AppendChild(d.CreateXmlDeclaration("1.0", null, null));
XmlElement eRoot = d.CreateElement("","root","");
d.AppendChild(eRoot);
XmlElement el = d.CreateElement(form.Name);
el.SetAttribute("Height", form.Height.ToString());
el.SetAttribute("Width", form.Width.ToString());
eRoot.AppendChild(el);
d.Save("bubba.xml");