if opendialog1.Execute then
  memo1.Lines.LoadFromFile(opendialog1.filename);

解决方案 »

  1.   

    if Opendialog1.Execute then
    //do something
      

  2.   

    opendialog1.Execute 返回的是一个布尔值,点确定返回TRUE;点取消返回FALSE;你上面的是点什么
    这个memo1.Lines.LoadFromFile(opendialog1.filename);
    这个都执行,所以就该这样
    if opendialog1.Execute then
      BEGIN
        memo1.Lines.LoadFromFile(opendialog1.filename);
      END;
      

  3.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      if opendialog1.Execute then
         memo1.Lines.LoadFromFile(opendialog1.filename);
    end;试试 (^_^)!
      

  4.   

    还有,你打开的是什么文件格式,能用memo打开吗。可以的话,就可以用:
    if opendialog1.Execute then
         memo1.Lines.LoadFromFile(opendialog1.filename);
      

  5.   

    试试一下的做法:
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      if opendialog1.Execute then
         memo1.Lines.LoadFromFile(opendialog1.filename);
    end;