how i can validate the XML file on Form Load ? ( XML file is empty )
private void Form1_Load(object sender, EventArgs e)
{
// --------------- Read XML File / Data: Settings_General
String xmlfile = "Settings_General.xml";
XmlDocument doc = new XmlDocument();
doc.Load(xmlfile);
XmlNode comboBox4Value = doc.SelectSingleNode("XMLFILE/Active");
if (comboBox4Value != null)
{
comboBox4.SelectedIndex = Convert.ToInt32(comboBox4Value.InnerText);
}
}
If xml is in invalid format then doc.Load(xmlfile);
will throw exception.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.