'How does one set the properties of components in a loop?

Right now, I am doing this:

with dmDatabase do
begin 
 panel1.Picture.LoadFromFile(tblDatabase['Picture']);
 tblDatabase.Next;
 panel2.Picture.LoadFromFile(tblDatabase['Picture']);
 tblDatabase.Next;
 panel3.Picture.LoadFromFile(tblDatabase['Picture']);
 //repeats for 16 panels...
end

Is there a way to do this in a loop? I've tried something like this:

begin
 for k 1 to 16 do
  begin
   ('panel' + k).Picture.LoadFromFile(tblDatabase['Picture']);
   tblDatabase.Next;
  end'

Obviously, it does not work. Is there a way to do this in a loop?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source