Hello Friends,
zuerst frohes 2021 wünsche ich allen
Mein Problem :
ich mochte gern auf ein Form platzierte mehrere Panels(mehr als 50) per Button-klick suchen und falls auf welche keine Caption vorhanden ist,ein neue caption zuweisen. Ich versuche mit follgende.... aber ohne Erfolg

Ich bitte um Hilfe !!
Delphi-Quellcode:
procedure TForm1.btn1Click(Sender: TObject);
var
CNAME, CAP: string;
i: Integer;
begin
CNAME := 'pnl';
CAP := 'LAST CHECK' ;
for i := 1 to 4 do
begin
if (FindComponent((CNAME[i])) as TPanel).caption <> '' then
(FindComponent((CNAME[i])) as TPanel).caption := CAP ;
end;
end ;
end.
Ein TestProjekt habe ich hinzugefügt.