lab5_4 progress
This commit is contained in:
43
lab5_4/Problem1_CalebFontenot/Form1.cs
Executable file
43
lab5_4/Problem1_CalebFontenot/Form1.cs
Executable file
@@ -0,0 +1,43 @@
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user