im...
procedure TForm1.Button1Click(Sender: TObject);
begin
with TForm2.Create(Application) do
try
ShowModal;
ShowMessage(vcID);
finally
Free;
end;
end;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
if not assigned(form2) then
form2:=tform2.create(Application);
try
if form2.ShowModal= mrok then //如果form2返回mrok 则 OK!
ShowMessage('OK!');
finally
form2.free;
form2:=nil;
end;
end;