Fairly new to coding, not sure where I've gone wrong here. The application Builds but crashes at runtime with the error: "Object reference not set to an instance of an object."
If I comment out test2 variable and 2nd condition then the application does what I want. When I un-comment the aforementioned then I get an exception.
I will eventually need to build something similar for a form of 30 checkboxes.
Any help would be greatly appreciated.
XmlDocument xDoc = new XmlDocument();
xDoc.Load(@"\\LEWBWPDEV\\ComplianceXmlStorage\\test.xml");
        string test1 = xDoc.SelectSingleNode("Introduction/Topic1").InnerText;
        string test2 = xDoc.SelectSingleNode("Introduction/Topic2").InnerText;
        if (test1 == "Yes")
        {
            checkBox1.CheckState = CheckState.Checked;
        }
        if (test2 == "Yes")
        {
            checkBox2.CheckState = CheckState.Checked;
        }
 
    