{******************************************************}
{ Desined for 有i个相同控件,如何指定到第i个。 }
{ copyright (c) 2003-2004 reserved }
{ Mail to [email protected] with any question}
{******************************************************}
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Edit9: TEdit;
Edit10: TEdit;
Button1: TButton;
Edit11: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
i,j,num:integer;
begin
if edit11.text<>'' then //edit11 is you input num
begin
num:=strtoint(edit11.Text);
j:=0;
for i:=0 to ComponentCount-1 do
begin
j:=j+1;
if j=num then
tedit(form1.Components[j-1]).Text:='ok';
end;
end;
end;
end.
本文地址:http://com.8s8s.com/it/it33168.htm