unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
var i:integer;
begin
for i:=1 to 16 do
with tedit.create(self) do
begin
parent:=self;
left:=60*i;
top:=20;
width:=58;
name:='MyEdit'+inttostr(i);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
begin
for i:=1 to 16 do
if self.findcomponent('Myedit'+inttostr(i))<>nil then
(self.findcomponent('Myedit'+inttostr(i)) as tedit).text:=inttostr(i);
end;
end.