I was reviewing my C # classes when I came across this
SaveFileDialog f = new SaveFileDialog();
f.Filter = "Archivo de Texto (.txt)|*.txt";
if (f.ShowDialog() == DialogResult.OK)
{
StreamWriter w = new StreamWriter(f.FileName);
w.Write(txtBlock.Text);
w.Close();
}
And I remembered that once my teacher used FileStream
SaveFileDialog f = new SaveFileDialog();
f.Filter = "Archivo de Texto (.txt)|*.txt";
if (f.ShowDialog() == DialogResult.OK)
{
FileStream s = new FileStream(f.FileName, FileMode.Create, FileAccess.Write);
StreamWriter w = new StreamWriter(s);
w.Write(txtBlock.Text);
w.Close();
}
And I would like to know what is the difference between using it or not.
PSDT: This code is used as an example to create a basic notepad