private void create()
        {
            RichTextBox txt = new RichTextBox();
            txt.Text += "1 \n";
            txt.Text += "2 \n";
            txt.Text += "3 \n";
            richTextBox1.Text = txt.Text;
           richTextBox1.SaveFile(Application.StartupPath + "\\1.txt", RichTextBoxStreamType.TextTextOleObjs);
       }

解决方案 »

  1.   

    richTextBox1.SaveFile(Application.StartupPath + "\\1.txt", RichTextBoxStreamType.PlainText);
    http://technet.microsoft.com/zh-cn/library/system.windows.forms.richtextboxstreamtype
      

  2.   

    richTextBox1.SaveFile(Application.StartupPath + "\\1.txt", RichTextBoxStreamType.TextTextOleObjs);
    richTextBox1.SaveFile(Application.StartupPath + "\\2.txt", RichTextBoxStreamType.TextTextOleObjs);
    如果写两行,第二行生成的就没有问题,第一行就是0字节,我就是一个晕啊..
      

  3.   

    vs2005版的C#中确实有这个问题,好像必须第2次才能保存上。
    新版的不知道解决了没有