procedure TForm1.Button1Click(Sender: TObject); var i, a: integer; begin a := 2; for i:=0 to self.ComponentCount-1 do if (self.Components[i] is TButton) and (i=a) then (Components[i] as TButton).Enabled := false; end;
procedure TForm1.Button4Click(Sender: TObject); var a: integer; begin a := 2; if FindComponent('Button'+IntToStr(a)) <> nil then TEdit(FindComponent('Button'+IntToStr(a))).Enabled := false; end;
var
i, a: integer;
begin
a := 2;
for i:=0 to self.ComponentCount-1 do
if (self.Components[i] is TButton) and (i=a) then
(Components[i] as TButton).Enabled := false;
end;
var
a: integer;
begin
a := 2;
if FindComponent('Button'+IntToStr(a)) <> nil then
TEdit(FindComponent('Button'+IntToStr(a))).Enabled := false;
end;