opendialog吗?就是要做个浏览的按钮,来找出文件!

解决方案 »

  1.   

    memo.Lines.LoadFromFile()————————————————————————————————————
    宠辱不惊,看庭前花开花落,去留无意;毁誉由人,望天上云卷云舒,聚散任风。
    ————————————————————————————————————
      

  2.   

    教你一个方法,在内存中打开DOC文件,或者是TXT文件,把所有的内容复制一下,再粘贴一下到MEMO1中,,
    procedure TFraDoc.TvDocClick(Sender: TObject);
    var
        Word:Variant;
    begin
        if Tvdoc.Selected=nil then exit;
        if not FileExists(SPath+'doc\'+TvDoc.Selected.Text+'.doc') then
        begin
            application.MessageBox('无此文档存在!',AppName,Gstitle);
            exit;
        end;
        try
        Word:=CreateOLeObject('Word.application');
        Word.visible:=false;
        Word.documents.add;
        begin
            word.selection.insertfile(SPath+'doc\'+TvDoc.Selected.Text+'.doc');
            word.Selection.WholeStory;
            word.Selection.Copy;
            Redt.Lines.Clear;
            Redt.PasteFromClipboard;
        end;
        finally
            word.quit(false);
        end;
    end;
      

  3.   

    没看懂问的什么问题,是要找到那个文件吗,用Opendialog就行了,然后取opendialog1.filename
      

  4.   

    memo.Lines.LoadFromFile(YourFileName);
      

  5.   

    memo.Lines.LoadFromFile(),我一直这样用。
      

  6.   

    步骤:
    1. opendialog 获得文件名
    2. 根据文件名显示内容到memo: loadfromfile()
      

  7.   

    var
      FileName : TextFile;
      Str,Tmp : String;
      TStrList : TStringList;
      i,k : Integer;
    begin
      TStrList := TStringList.Create;
      TStrList.Clear;
      if not (FileExists(GetNameDir(Application.ExeName)+'xuanhao.txt')) then
      begin
        Application.MessageBox('xuanhao.txt文件不存在,请先转出TXT文件','提示',MB_OK+MB_ICONSTOP);
        Exit;
      end;
      AssignFile(FileName,GetNameDir(Application.ExeName) + 'xuanhao.txt');
      Reset(FileName);
      Readln(FileName,Str);
      CloseFile(FileName);
      if Str <> '' then
      begin
        i := pos(',',str);
        while i > 0 do
        begin
          Tmp := copy(Str,1,i - 1);
          TStrList.Add(Tmp);
          Str := copy(Str,i + 1,length(Str)-i);
          i := pos(',',Str);
        end;
        if Str <> '' then
        begin
          TStrList.Add(Str);
        end;
      end;
      

  8.   

    if opendialog1.execute() then
      memo.Lines.LoadFromFile(opendialog1.filename);
      

  9.   

    我要按钮打开文件夹,然后随便选一个txt文件,把其中的内容显示再memo中..
      

  10.   

    添加一个opendialog,在按钮的click下添加如下代码:
      if opendialog1.execute then
      memo.Lines.LoadFromFile(opendialog1.filename);
      

  11.   

    memo1.Lines.LoadFromFile(opendialog1.filename);
      

  12.   

    if opendialog1.execute() then
      memo.Lines.LoadFromFile(opendialog1.filename); 
    这样还不行!!!!!!!!!!!!!!1
      

  13.   

    LoadFromFile这种方法看来还是用得比较多的而huayuxing(huayuxing)、 fhuibo(Sailor) 两位兄才的方法还真不错不信你试试
      

  14.   

    memo.Lines.LoadFromFile('c:\login.txt')
      

  15.   

    我要显示的是.doc .txt的内容啊!
      

  16.   

    if opendialog1.execute() then
      memo.Lines.LoadFromFile(opendialog1.filename); 这样做,是把改文件的路径写到memo中啊!
      

  17.   

    memo.Lines.LoadFromFile()
    要把过滤器设为。txt和。doc等