string txt = textBox1.Text;//写到txt的内容 string filename = "t.txt"; //t.txt是文件名,可以带路径。 System.IO.StreamWriter sw = new System.IO.StreamWriter(filename); sw.Write(txt); sw.Close();