Complete lab5_4
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user