(*
一般的清空combobox方法
combobox1.clear;
...
combobox9.clear;
*)
procedure TForm1.Button1Click(Sender:
TObject);
TObject);
var i: integer;
begin
for i:=0 to self.ComponentCount-1
do
do
begin
if self.Components[i] is TCombobox
then
then
TCombobox(self.Components[i]).clear;
end;
end;
//Components[i]清除所有edit控件中的内容
procedure
TForm1.Button1Click(Sender: TObject);
var i: integer;
begin
for i:=0 to Form1.ComponentCount-1 do
begin
if Form1.Components[i] is TEdit then//如果是Edit控件
TEdit(Form1.Components[i]).Text:=''//清除其中的内容
end;
end;
procedure
TForm1.Button1Click(Sender: TObject);
var i: integer;
begin
for i:=0 to Form1.ComponentCount-1 do
begin
if Form1.Components[i] is TEdit then//如果是Edit控件
TEdit(Form1.Components[i]).Text:=''//清除其中的内容
end;
end;