Hi there,
I'm using Delphi 2006...
Here's my code to clone a form (as written on about.com):
---------------------------------------
function FormClone(frm: TForm): TForm;
var ms: TMemoryStream;
begin
ms := TMemoryStream.Create;
try
ms.WriteComponent(frm);
ms.Position := 0;
Result := TFormClass(frm.ClassType).CreateNew(Application);
ms.ReadComponent(Result);
finally
ms.Free;
end;
end;
---------------------------------------
It results in an EComponentError:
A component named 'btnCancel' already exists.
How to solve this problem???
Thanks a lot,
RC
I'm using Delphi 2006...
Here's my code to clone a form (as written on about.com):
---------------------------------------
function FormClone(frm: TForm): TForm;
var ms: TMemoryStream;
begin
ms := TMemoryStream.Create;
try
ms.WriteComponent(frm);
ms.Position := 0;
Result := TFormClass(frm.ClassType).CreateNew(Application);
ms.ReadComponent(Result);
finally
ms.Free;
end;
end;
---------------------------------------
It results in an EComponentError:
A component named 'btnCancel' already exists.
How to solve this problem???
Thanks a lot,
RC