如下所示:
f1:='Frm_Sand';
tf1:='TFrm_Sand';
//CreateMyForm(tf1,f1);
ifApplication.FindComponent(f1)=nilthen
begin
ifGetClass(Tf1)nilthen
begin
withTForm(TComponentClass(FindClass(Tf1)).Create(application))do
begin
name:=f1;
showmodal;
free;
end;
end;
end
else
begin
TForm(Application.FindComponent(f1)).ShowModal;
free;
end;
用以上代码生成了窗体frm_sand,然后在窗体frm_sand上又创建打开了一个窗体Form1,在FORM1中引用frm_sand.edit1.text的时候出错,若在引用前创建frm_sand实例,则显示的值为空
分 -->