private void button2_Click(object sender, EventArgs e)
{
FileStream fs = new FileStream(label1.Text, FileMode.Open);
StreamWriter w = new StreamWriter(fs, Encoding.Default);
for (int i = 0; i < richTextBox1.Lines.Length; i++)
{
/* StreamWriter f = new StreamWriter(label1.Text);
f.WriteLine(richTextBox1.Lines[i]);
f.Close(); */
w.WriteLine(richTextBox1.Lines[i]);
}
fs.Close();
w.Close();
}
using(FileStream fs = new FileStream(label1.Text, FileMode.Open))
{
using(StreamWriter w = new StreamWriter(fs, Encoding.Default))
{
for (int i = 0; i < richTextBox1.Lines.Length; i++)
{
w.WriteLine(richTextBox1.Lines[i]);
}
}
}