winfrom 中form_activated事件

private void Form1_Activated(object sender, EventArgs e)
        {
         string path = @"d:我的文档Visual Studio 2010Projects文件管理器文件管理收集.txt";
            using (StreamWriter sw = new StreamWriter(path, false))
            {
                sw.Write(txtnote.Text);
            }
            MessageBox.Show("文件已保存");
        }

在事件中执行保存的代码,但是文本内容丢失了。

原文地址:https://www.cnblogs.com/ggg34674/p/3343589.html