I'm trying to export the list box items into xml file , I'm able to export single value objects such as text box, radio button, check boxes...
<Setting Name="txt_ImageQuality">20</Setting>
<Setting Name="txt_ImageType">JPG</Setting>
<Setting Name="rdio_checkedStatus">True</Setting>
but I want to export the following listbox items into XML.
is there any ways around in c#, thanks for your time.
Could you please try the below code snippet and please vote the answer if its usefult
XElement element = new XElement("Items");
foreach (var item in listBox1.Items)
{
element.Add(new XElement("Name", item));
}
XDocument document = new XDocument();
document.Add(element);
document.Save("items.xml",SaveOptions.DisableFormatting); //create items.xml file in bin folder