im working on a notepad application when i click on open or save command n after click on cancel in opendialoge box i got error.


Code:
 private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();
            dlg.Title = "Open";
            dlg.Filter = "Text Documents(*.*)|*.*|All Files(*.*)|*.*";
            dlg.ShowDialog();
            richTextBox1.LoadFile(dlg.FileName);
 
        }
 
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog dlg = new SaveFileDialog();
            dlg.Title = "Open";
            dlg.Filter = "Text Documents(*.*)|*.*|All Files(*.*)|*.*";
            dlg.ShowDialog();
            richTextBox1.SaveFile(dlg.FileName);
        }