(* Collection of code snippets by Arne Vajhøj *)
(* (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) *)
unit DynLblUnit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

var
  dl : array [0..9] of TLabel;

procedure TForm1.Button1Click(Sender: TObject);

var
  i : integer;

begin
  for i := 0 to 9 do begin
     dl[i] := TLabel.Create(Self);
     dl[i].Parent := Form1;
     dl[i].Caption := 'Label #' + IntToStr(i);
     dl[i].Left := (i mod 5) * 50;
     dl[i].Top := (i div 5) * 20;
  end;
end;

end.
