I am trying to make a value from a .xml file equal to a drop down box inside another form. In vb.net I can just call the form automatically, but inside C# I had to use the code ApplicationProperties ApplicationPropertiesWindow = new ApplicationProperties();
to open the other form.
private void Form1_Load(object sender, EventArgs e)
{
//Declaring the XmlReader.
XmlTextReader Reader = new XmlTextReader(@"C:\ForteSenderv2.0\Properties.xml");
while (Reader.Read())
{
switch (Reader.NodeType)
{
//Seeing if the node is and element.
case XmlNodeType.Text:
case XmlNodeType.Element:
if (Reader.Name == "BaudRate")
{
//Reading the node.
Reader.Read();
//Making the Baud Rate equal to the .xml file.
Form.ApplicationProperties.BaudRatebx.SelectedIndex = Reader.Value;
}
}
}
}
Why can I not call the form using:
ApplicationPropertiesWindow.BaudRatebx.SelectedIndex = Reader.Value
I am reading from a .xml file where the value of BaudRatebx is stored. I am trying to read from it and make the value from the .xml file equal to the BaudRatebx. The only problem is that BaudRatebx is on another form and I cannot call it because I do not know how, when I try to call the dropdown box it says BaudRatebx is inaccessible due to its protection level. There isn't any code for the BaudRatebx being declared as I did that in the designer.