应该自己搜索一下先的,太懒了 第一个回文的,分数都拿去。 procedure TForm1.Button1Click(Sender: TObject); var i : Integer; begin for i := 0 to Form1.ControlCount-1 do begin if Form1.Controls[i] is TEdit then ShowMessage( Form1.Controls[i].Name ); end; end;
procedure TForm1.Button1Click(Sender: TObject); var 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 TForm1.Button1Click(Sender: TObject);
var
i : Integer;
begin
for i := 0 to Form1.ControlCount-1 do
begin
if Form1.Controls[i] is TEdit then
ShowMessage( Form1.Controls[i].Name );
end;
end;
var
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;
和结果TEdit
想用一个循环为这些TEdit赋值??
问题描述得不太清楚哦!
你的代码已经篇历了组件了哦!
你要向TEDIT中赋什么值呢?
请详细点。