i need help with this bit of code, any help will be greatly appreaciated...private void btnWriteXml_Click(object sender, EventArgs e){ XmlTextWriter xtw = null; string fileName = "ComboItemName.xml"; try
{
xtw = new XmlTextWriter(fileName, Encoding.UTF8);xtw.Formatting = Formatting.Indented;xtw.WriteStartDocument();xtw.WriteStartElement("ITEMS");So this method only adds the current text in the text boxes and re-writes anything else...xtw.WriteElementString("NAME", this.txtName.Text.ToString());xtw.WriteElementString("URL", this.txtUrl.Text.ToString());
this method works but i need help with a way to check to see if the items in the list box exits in the XML file, otherwise it duplicates averything...for (int i = 0; i < this.comboBoxUrl.Items.Count; i++){xtw.WriteElementString("NAME", this.comboBoxUrl.Items[i].ToString());xtw.WriteElementString("URL", this.comboChannels.Items[i].ToString());}for (int j = 0; j < this.comboBoxUrl.Items.Count; j++){ xtw.WriteElementString("URL", this.comboBoxUrl.Items[j].ToString());}
xtw.WriteEndElement();
xtw.WriteEndDocument();
}
finally
if (xtw != null)
xtw.Close();