B
blankblock@263.
Unregistered / Unconfirmed
GUEST, unregistred user!
新建Application,其中有Form1和Form2,在Form1的Button1的事件中加入:
procedure TForm1.Button1Click(Sender: TObject);
var
tmpForm:TForm2;
begin
tmpForm:=TForm2.Create(Application);
try
tmpForm.Assign(Form2);
tmpForm.ShowModal;
finally
tmpForm.Free;
end;
end;
编译通过,在运行时点击Button1,出现以下错误:cannot assign a TForm2 to TForm2?
请问为什么?Assign不就是干这个用的吗?
procedure TForm1.Button1Click(Sender: TObject);
var
tmpForm:TForm2;
begin
tmpForm:=TForm2.Create(Application);
try
tmpForm.Assign(Form2);
tmpForm.ShowModal;
finally
tmpForm.Free;
end;
end;
编译通过,在运行时点击Button1,出现以下错误:cannot assign a TForm2 to TForm2?
请问为什么?Assign不就是干这个用的吗?