private void button1_Click(object sender, EventArgs e) { FileStream fs = new FileStream("123.txt", FileMode.Append); StreamWriter ws = new StreamWriter(fs); ws.WriteLine(this.txtbox.Text = DateTime.Now.ToString()+" " + "写入成功"); ws.Close(); fs.Close(); } private void button2_Click(object sender, EventArgs e) { FileStream fs = new FileStream("123.txt", FileMode.Open); StreamReader ws = new StreamReader(fs); this.txtbox.Text = ws.ReadToEnd(); ws.Close(); fs.Close(); }