tf:= Application.FindComponent('test') as TForm2;
So was ist schlecht. Wenn etwas gefunden wird was test heisst aber nicht vom Type TForm ist fliegt die das um die Ohren.
Besser:
Delphi-Quellcode:
var C: TComponent;
begin
C:= TForm(Application.FindComponent('test'));
if C = nil then
begin
Application.CreateForm(TForm, Form2);
Form2.Name:= 'test';
Form2.Show;
end
else
if C is TForm then
with C as TForm do Height:= 300;
end;