Complete lab5_4

This commit is contained in:
2022-10-27 18:18:14 -05:00
parent b95e6e4048
commit a2c0821c4b
91 changed files with 237 additions and 59 deletions

View File

@@ -28,16 +28,24 @@ namespace Problem1_CalebFontenot
private void saveButton_Click(object sender, EventArgs e)
{
// Create StreamWriter
StreamWriter outputFile = null;
try {
StreamWriter sw = null;
//Open the save file dialog.
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
string s = saveFileDialog1.FileName;
sw = File.CreateText(s);
//Open the save file dialog.
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
for (int i = 0; i < listBox1.Items.Count; i++)
{
sw.WriteLine(listBox1.Items[i].ToString());
}
sw.Close();
}
} catch (Exception ex)
{
outputFile == File.OpenWrite(saveFileDialog1.FileName);
MessageBox.Show(ex.Message);
}
}
}
}
}