我如何实现c#setmodifiedflag语法

时间:2016-01-17 08:44:24

标签: c#

我为文本文件制作了一个简单的编辑器。 我想添加这个功能: 如果关闭未保存的文件,我想要一个警告。

我如何使用setmodifiedflag。

我的代码是:

 private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
           SaveFileDialog saveFileDialog1 = new SaveFileDialog();
           saveFileDialog1.Filter= "Ticker Files,*.tic, *.csv|*.tic;*.csv;";
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                try
                {

                    File.WriteAllText(saveFileDialog1.FileName, richTextBox1.Text);

                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());

                }
        }

        private void True(object sender, KeyPressEventArgs e)
        {
          (here I will call the setmodified flag, how to?)
        }

提前感谢。

0 个答案:

没有答案