请问如何使一个字符串变为已存在Edit?比如说我现在已经存在Edit1到Edit10这些控件,但我进行取值和赋值时为了方便使用循环:for i:=1 to 10 do
begin
  TEdit('Edit'+inttostr(i)).text:='hello';
end;但这样做是错误的,请问应该怎样做才能达到这个效果呢???

解决方案 »

  1.   

    Tedit(FindComponent('edit' + IntToStr(i))).text
      

  2.   

    var
      I: Integer;
    begin
      for I:= 0 to ControlCount -1 do
        if Controls[I] is TEdit then
           TEdit(Controls[I]).text:='hello';
    end;
      

  3.   


    (('Edit'+inttostr(i)) as TEdit).Text := 'hello';
      

  4.   

    就是 blueshu(绝对是菜鸟) 的方法, Wally_wu(韦利) 的方法肯定不行,guestman(天涯浪子)的可以!
      

  5.   

    我有个笨方法,你可a:array [0..10] of TEdit;
    a[0]:=edit1;
    ..
    a[10]:=edit10;