TCheckBox(findcomponent('CheckBox'+IntToStr(i))).Checked := false;
TClientSocket(findcomponet('ClientSocket'+IntToStr(i))).Active := false;

解决方案 »

  1.   

    findcomponet  寫錯了! findcomponent
      

  2.   

    procedure TForm1.Button1Click(Sender: TObject);var
      i: Integer;
    const
      NamePrefix = 'MyEdit';
    begin
      for i := 1 to 20 do begin
        TEdit.Create(Self).Name := NamePrefix + IntToStr(i);
        with TEdit(FindComponent(NamePrefix + IntToStr(i))) do
        begin
          Left := 10;
          Top := i * 20;
          Parent := self;
        end;
      end;
    end;