不知这样可否?
//frmA
type
TfrmA=class(TForm)
...
private
tmpS:string;
end;
function ShowfrmA(var s:string):TModalResult;
implementation
function ShowfrmA(var s:string):TModalResult;
var
frm:TfrmA;
begin
frm:=TfrmA.create(nil);
try
frm.tmpS:=s;
result:=frm.ShowModal;//在TfrmA中更改tmpS
s:=tmpS;
finally
frm.free;
end;
end;
//frmB
procedure TForm1.Button1Click(Sender: TObject);
var
s:string;
begin
if ShowfrmA(s)=mrOK then
edit1.text:=s;
end;