Re: how do I delete a component created at runtime?

Posted by Joey on February 20, 2004 at 10:33:35:

In Reply to: Re: how do I delete a component created at runtime? posted by PIP on February 20, 2004 at 00:12:57:

If you want the name of the component you can create a global variable "wateva: TObject" then in the onlick or whateva even do "wateva := Sender" then do "wateva.Destroy" or to cut that out and not gather the name you could simply do "Sender.Destroy" which would kill the component running the event.

procedure TForm1.Button1Click(Sender: TObject);
begin
  Sender.Destroy;
end;

this would destroy Button1 in the simplest way.

If this didnt answer ur question just tell me what i missed :S

hope it helps tho ;)


[ Delphi Forum ]