I'm working with ListBoxes in WPF and am trying to save items from different list boxes into the same file. As for now each listbox gets their own file.
This is my code so far:
private void OnSaveAs()
{
SaveFileDialog save = new SaveFileDialog();
save.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
if (save.ShowDialog() == true)
{
//File.WriteAllText(save.FileName, InputsMinMax.Text);
}
if (this.InputsMV.Items.Count > 0 && save.ShowDialog() == true)
{
using (FileStream S = File.Open(save.FileName, FileMode.CreateNew))
{
using (StreamWriter st = new StreamWriter(S))
{
foreach (var aa in InputsMV.Items)
st.WriteLine(aa.ToString());
}
}
}
}