private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string txt = "";
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = "Text File|*.txt";
            ofd.FileName = "File";
            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
                StreamReader sr = new StreamReader(File.OpenRead(ofd.FileName));
                while (txt != null) {
                    txt += sr.ReadLine() + "\n";
                    if (txt != null) richTextBox1.Text += txt;
                    else sr.Dispose();
                }
            }
        }
これは、開いているメニュー ストリップ項目がクリックされたときに実行することを目的とした私のコードです。しかし、どういうわけか、これは私のアプリケーションで立ち往生します。コードのエラーは何ですか?