using System.IO;StreamWriter myTxtWriter=new StreamWriter(
           DateTime.Now.Date.ToString()+".txt",false);
myTxtWriter.Write(textBox1.Text);
myTxtWriter.Flush();
myTxtWriter.Close();

解决方案 »

  1.   

    Sorry:StreamWriter myTxtWriter=new StreamWriter(
    DateTime.Now.Date.ToString("yyyyMMdd")+".txt",false);
      

  2.   

    Knight94(愚翁)老先生是个强人,我问过他很多问题,不错,兄弟,听他的,肯定对!
    帮你顶一个!
      

  3.   


     写得很乱但能用:  private void button1_Click(object sender, System.EventArgs e)
    {                           string st1=""; DateTime dt=DateTime.Now;
    string st=dt.Date.ToShortDateString();
    string path="c:\\"+st+".txt"; if(File.Exists(path)) 
    {
    FileStream fs=File.Open(path,FileMode.Open); StreamReader sr=new StreamReader(fs);
    st1=sr.ReadToEnd();
    fs.Close();
    sr.Close();
    File.Delete(path);
    } FileStream fs1=File.Open(path,FileMode.Create); StreamWriter sw = new StreamWriter(fs1);
    sw.WriteLine (textBox1.Text);
    sw.WriteLine ("-----------------------------------");
    sw.WriteLine(st1);

    sw.Close();
    } :)