I'm trying to do a replica of Notepad, in the part of saving the content in richTextBox1.Text I'm having the problem:
System.IO.IOException: "The process can not access the 'file path' file because it is already being used by another process.
private void salvarComoToolStripMenuItem_Click(object sender, EventArgs e)
{
SaveFileDialog fileDialog = new SaveFileDialog();
fileDialog.Filter = "|*.txt";
fileDialog.ShowDialog();
fileDialog.OpenFile();
string path = fileDialog.FileName;
fileDialog.Dispose();
richTextBox1.SaveFile(path);
}