private voidForm1_Load(object sender,EventArgs e)
{
XmlDocument xDoc = newXmlDocument();
xDoc.Load(@"D:\DocumentsOrder.xml");
for (int i = 0; i <>
{
//Add the innertext of the xml document to the listbox
listBox1.Items.AddRange(newobject[] { xDoc.DocumentElement.ChildNodes[i].InnerText });
}
}
On Delete Button Click event write the following Code:
private voidbutton5_Click(object sender,EventArgs e)
{
XmlDocument xDoc = newXmlDocument();
xDoc.Load(@"D:\DocumentsOrder.xml");
//Add the innertext of the xml document to the listbox
xDoc.DocumentElement.RemoveChild(xDoc.DocumentElement.ChildNodes[listBox1.SelectedIndex]);
FileStream WRITER = newFileStream(@"D:\DocumentsOrder.xml", FileMode.Truncate,FileAccess.Write,FileShare.ReadWrite);
xDoc.Save(WRITER);
//Close the writer filestream
WRITER.Close();
//Form1_Load(new object(), new EventArgs());
}