是这样的:
procedure TForm1.N1Click(Sender: TObject);
var
     ss:string;
begin
     if (OpenDialog1.Execute)  then
        begin
             ss:=OpenDialog1.FileName;
        end;
     showmessage(ss);
end;编译没有错误,可是运行有错误,而且是内存地址错的那种是不是 因为 OpenDialog1.FileName 得到的不是 string 类型我想把 OpenDialog1.FileName 的值放到 edit1 里那要怎么办呢?edit1.text 是字符串啊?
谢谢!

解决方案 »

  1.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, Grids, Menus;type
      TForm1 = class(TForm)
        PopupMenu1: TPopupMenu;
        N1: TMenuItem;
        StringGrid1: TStringGrid;
        OpenDialog1: TOpenDialog;
        procedure N1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.N1Click(Sender: TObject);var
         ss:string;
    begin
         if (OpenDialog1.Execute)  then
            begin
                 ss:=OpenDialog1.FileName;
            end;
         showmessage(ss);
    end;end.
    帮我试试,好吗?谢谢!
      

  2.   

    dragonki 大哥,帮我试试,好吗
    我这里还是不行啊!
    谢谢!