var
x:integer;
k:integer;
EditID:string;
IsNumber:Boolean;
begin
for x:=0 to Form1.ComponentCount-1 do
begin
if Form1.Components[x] is TEdit then
begin
EditID:=Form1.Components[x].Name;
EditID:=Copy(EditID,Pos('Edit',EditID)+4,StrLen(PChar(EditID))-Pos('Edit',EditID));
IsNumber:=True;
k:=StrLen(PChar(EditID));
while(K>0) do
begin
if Pos(EditID[k],'0123456789')=0 then IsNumber:=False;
dec( k);
end;
if IsNumber then TEdit(Form1.Components[x]).Text:=EditID;
end;
end;
end;
//改一下格式
procedure TForm1.SetNull;
var
i:integer;
count:integer;
begin
for i:=0 to self.ComponentCount-1 do
begin
if (self.Components[i] is Tedit) then
begin
count := count+1;
(self.Components[i] as Tedit).Text:=inttostr(count);
end;
end;
end;
procedure TForm1.SetNull;
var
i:integer;
count:integer;
begin
for i:=0 to self.ComponentCount-1 do
begin
if (self.Components[i] is Tedit) then
begin
count := count+1;
(self.Components[i] as Tedit).Text:=inttostr(count);
end;
end;
end;
const
N = 10;
var
I: Integer;
vEdit: TEdit;
begin
for I := 1 to N do
begin
TComponent(vEdit) := FindComponent(Format('Edit%d', [I]));
if vEdit is TEdit then
vEdit.Text := Format('%d', [I])
end;
end;