Mirror

Access components by their name property (Views: 14844)


Problem/Question/Abstract:

How to access components by their name property

Answer:

The following example uses the FindComponent method of Form1 to disable the first 10 SpeedButtons by name:

for i := 1 to 10 do
  with Form1.FindComponent('SpeedButton' + IntToStr(i)) as TSpeedButton do
    Enabled := False;

<< Back to main page