窗体:
private void writeIn_Click(object sender, EventArgs e){FileStream fs = new FileStream(@"Login.txt", FileMode.OpenOrCreate);StreamWriter sw = new StreamWriter(fs);sw.Write(this.label1.Text);sw.Write(this.textBox1.Text + "\r\n");sw.Write(this.label2.Text);sw.Write(this.textBox2.Text);sw.Close();fs.Close();}
ps:@"Login.txt"这是文本路径,可以自己写绝对路径,要引入system.IO命名空间