for i:=0 to ComponentCount-1 do begin if Components[i] is TDBcomboBox then with Components[i] as TDBcomboBox do ... if Components[i] is TDBedit then with Components[i] as TDBedit do ... if Components[i] is TDBmemo then with Components[i] as TDBmemo do ... ... end;
for i:=0 to ComponentCount-1 do begin if Components[i] is TButton then end; ================================= for i:=0 to Panel1.ControlCount-1 do begin if Panel1.Controls[i] is TButton then ShowMessage((Panel1.Controls[i] as Tbutton).Caption); end;
然后利用formX.Controls[]进行判断
if Components[i] is TDBcomboBox then
with Components[i] as TDBcomboBox do ...
if Components[i] is TDBedit then
with Components[i] as TDBedit do ...
if Components[i] is TDBmemo then
with Components[i] as TDBmemo do ...
...
end;
begin
if Components[i] is TButton then
end;
=================================
for i:=0 to Panel1.ControlCount-1 do
begin
if Panel1.Controls[i] is TButton then
ShowMessage((Panel1.Controls[i] as Tbutton).Caption);
end;