Zitat:
Delphi-Quellcode:
for x := 0 to 409 do
begin
(FindComponent('Label' + IntToStr(x + 2)) as TLabel).Caption :=
IntToStr(Counte[x]);
Das kann man umschreiben und damit die versteckte innere Schleife (FindComponent) entfernen.
Delphi-Quellcode:
for i := 0 to ComponentCount - 1 do
begin
if (Components[i] is TLabel) and AnsiStartsText('Label', Components[i].Name) then
begin
x := StrToInt(Copy(Components[i].Name, 6, MaxInt));
if (x >= 0) and (x <= 409) then
TLabel(Components[i]).Caption := IntToStr(Counte[x]);
end;
end;