function CreateMyForm(s: string): TForm;
begin
Result := nil;
if pos('Form1',s) >0 then begin
Result := TForm1.Create(Self);
exit;
end else if pos('Form2',s) >0 then begin
Result := TForm2.Create(Self);
exit;
end;
end;
procedure TForm2.Button4Click(Sender: TObject);
var Form: TForm; C: TPersistentClass;
begin
C:=GetClass(Edit1.Text);
if Assigned(C)
then begin
try
Application.CreateForm(TComponentClass(C), Form);
Form.Show;
except