namespace Problem1_CalebFontenot { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void openButton_Click(object sender, EventArgs e) { // Create StreamReader StreamReader inputFile = null; // Read the contents of the text file. if (openFileDialog1.ShowDialog() == DialogResult.OK) { inputFile = File.OpenText(openFileDialog1.FileName); } // Clear the listbox. listBox1.Items.Clear(); while (!inputFile.EndOfStream) { listBox1.Items.Add(inputFile.ReadLine()); } } private void saveButton_Click(object sender, EventArgs e) { // Create StreamWriter StreamWriter outputFile = null; //Open the save file dialog. if (saveFileDialog1.ShowDialog() == DialogResult.OK) { outputFile == File.OpenWrite(saveFileDialog1.FileName); } } } }