Can anyone help me with the following problem? : I have two forms in my winform application. In form1, i have a button to open form2 with. In form2, i have a Listbox getting his items from XML:
private void FillListBox()
{
string filename = @"employee.xml";
XmlDocument doc = new XmlDocument();
doc.Load(filename);
XmlNodeList xnList = doc.SelectNodes("/Information/username");
foreach (XmlNode xn in xnList)
{
ListboxUsername.Items.Add(xn.InnerText);
}
}
in form1, i have a combobox also getting his items from the same XML file:
public void FillCombobox()
{
comboboxPersonen.Items.Clear();
string filename = @"emplyee.xml";
XmlDocument doc = new XmlDocument();
doc.Load(filename);
XmlNodeList xnList = doc.SelectNodes("/Information/username");
foreach (XmlNode xn in xnList)
{
comboboxUsername.Items.Add(xn.InnerText);
}
}
In form2 i'm able to edit the xmlnodelist in the listboxUsername. And when closing form2, i want the most recent items in the comboboxUsername. Something like a postback in asp.net, but then in winforms application. Any suggestions?
private void Form2_FormClosing(object sender, FormClosingEventArgs e)
{
//acces comboboxusername in form1 to update it with recent xml list items
}
thanks for your time.