unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) lblOutput: TLabel; procedure FormCreate(Sender: TObject); private { Private-Deklarationen } public { Public-Deklarationen } procedure ok(Sender: TObject); end; var Form1: TForm1; btnOK: array[0..9] of TButton; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); var i: byte; begin for i:=0 to 9 do begin btnOK[i]:=TButton.Create(self); with btnOK[i] do begin Parent:=Form1; width:=50; Left:=50*i+10; Top:=20; Caption:=IntToStr(i+1); Tag:=i+1; Show; OnClick:=ok; end; end; end; procedure TForm1.ok(Sender: TObject); begin lblOutput.Caption:=IntToStr(TButton(Sender).Tag); end; end.