ar i, j : integer; strList : TStringList; begin strList := TStringList.Create; strList.Add('aaaaaaa'); strList.Add('bbbbbbb'); strList.Add('ccccccc'); strList.Add('ddddddd'); j := 0; for i := 0 to Self.ComponentCount -1 do begin if Self.Components[i] is TEdit then begin TEdit(Self.Components[i]).Text := strList.Strings[j]; j := j + 1; end; end; strList.Free; end;
ar i, j : integer; strList : TStringList; begin strList := TStringList.Create; strList.Add('aaaaaaa'); strList.Add('bbbbbbb'); strList.Add('ccccccc'); strList.Add('ddddddd'); j := 0; for i := 0 to Self.ComponentCount -1 do begin if Self.Components[i] is TEdit then begin TEdit(Self.Components[i]).Text := strList.Strings[j]; j := j + 1; end; end; strList.Free; end;
ar i, j : integer; strList : TStringList; begin strList := TStringList.Create; strList.Add('aaaaaaa'); strList.Add('bbbbbbb'); strList.Add('ccccccc'); strList.Add('ddddddd'); j := 0; for i := 0 to Self.ComponentCount -1 do begin if Self.Components[i] is TEdit then begin TEdit(Self.Components[i]).Text := strList.Strings[j]; j := j + 1; end; end; strList.Free; end;
以下是确定窗体有几个控件的例程procedure TFDemo.Button2Click(Sender: TObject); var i,j:integer; begin j:=0; for i:=0 to FDEmo.ControlCount-1 do begin if FDemo.Controls[i] is TEdit then j:=j+1; end; showmessage(inttostr(j));////显示有几个EDIt 控件 end;
i, j : integer;
strList : TStringList;
begin
strList := TStringList.Create;
strList.Add('aaaaaaa');
strList.Add('bbbbbbb');
strList.Add('ccccccc');
strList.Add('ddddddd');
j := 0;
for i := 0 to Self.ComponentCount -1 do
begin
if Self.Components[i] is TEdit then
begin
TEdit(Self.Components[i]).Text := strList.Strings[j];
j := j + 1;
end;
end;
strList.Free;
end;
i, j : integer;
strList : TStringList;
begin
strList := TStringList.Create;
strList.Add('aaaaaaa');
strList.Add('bbbbbbb');
strList.Add('ccccccc');
strList.Add('ddddddd');
j := 0;
for i := 0 to Self.ComponentCount -1 do
begin
if Self.Components[i] is TEdit then
begin
TEdit(Self.Components[i]).Text := strList.Strings[j];
j := j + 1;
end;
end;
strList.Free;
end;
i, j : integer;
strList : TStringList;
begin
strList := TStringList.Create;
strList.Add('aaaaaaa');
strList.Add('bbbbbbb');
strList.Add('ccccccc');
strList.Add('ddddddd');
j := 0;
for i := 0 to Self.ComponentCount -1 do
begin
if Self.Components[i] is TEdit then
begin
TEdit(Self.Components[i]).Text := strList.Strings[j];
j := j + 1;
end;
end;
strList.Free;
end;
var
i,j:integer;
begin
j:=0;
for i:=0 to FDEmo.ControlCount-1 do
begin
if FDemo.Controls[i] is TEdit then
j:=j+1;
end;
showmessage(inttostr(j));////显示有几个EDIt 控件
end;
如果是统计在控件上的控件数,用:控件名.ControlCount