rewrite(outfile,fname);这个什么意思?这个肯定错!
改委:rewrite(outfile);
你要存储,为什么不用 MdiChild.memo1.Lines.SaveToFile(Fname);
    

解决方案 »

  1.   

    to:dana    
    write(Outfile,MDIChild.memo1.text);
    有问题
        
      

  2.   

    to ch81
    异常仍然存在.请多多赐教.
      

  3.   

    procedure Rewrite(var F: File [; Recsize: Word ] );
    用法如上,你这句话能通过???
    rewrite(outfile,fname);
      

  4.   

    //这样写是不会出错的!
    procedure TForm1.Button1Click(Sender: TObject);
    var F:TextFile;
    begin
            AssignFile(F,'1.txt');
            Rewrite(F);
            Write(F,Memo1.Text);
            CloseFile(F);
    end;
      

  5.   

    if savedialog1.Execute
         then
         begin
         fname:=savedialog1.filename;
         assignfile(outfile,fname);
         rewrite(outfile);
         write(Outfile,MDIChild.Rightmemo1.text);
         closefile(outfile);
         end;
    不行.问题仍然存在.
      

  6.   

    那就可能是mdichild错了。你的mdichild注意是一个窗体,还是一个窗体的数组!!
    Form1.MDIChildren[index].Memo
      

  7.   

    哥们,说实话child是窗体还是数组我没有明确的看法.我觉的可能是算数组.
    看下面的代码
    procedure TMainForm.FileNew1Execute(Sender: TObject);
    begin
      CreateMDIChild('新建' + IntToStr(MDIChildCount + 1));
    end;
    下的看你的啦.oicq?我的6341055
      

  8.   

    我要做的是mdi风格的记事本.ch81说的很可能有道理.
    因为我的代码里没有指定mdichild的句丙.
    也就是说没有指定要保存哪个mdichild的文本.
    俺不知上述代码里windows是否保存当前激火的子窗口内容.
    大峡们继续参与.
      

  9.   

    assignfile(outfile,fname)后现加一句:
    Reset(outfile)
      

  10.   

    MDIChild变量是在哪里定义的?
      

  11.   

    我的mdichild是这样的定义的
    interfaceuses Windows, Classes, Graphics, Forms, Controls, StdCtrls, RightMemo;type
      TMDIChild = class(TForm)
        Memo1: TMemo;
        procedure FormClose(Sender: TObject; var Action: TCloseAction);
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end; var
    MDIChild:TMDIChild;
    implementationuses Main;
    大峡们,帮帮呀
      

  12.   

    我在主form里引用childwin(mdichild的单元名),然后直接使用mdichild.rightmemo.text来
    把文本写到文本文件.
    你可以参考delphi的new\project页mdi程序范例,我用的memo特殊的memo,其他的完全一样,
    我在范例(没有修改)里也试过了,但是还是存在一样的问题.
    请继续讨论.