清空所有Edit内容
Code
//清空当前界面所有文本框过程
procedure ClearText(AControl:TWinControl);
var I : Integer;
begin
for I := 0 to AControl.ControlCount - 1 do // Iterate
begin
//需清空处理控件
if AControl.Controls[i] is TCustomEdit then
begin
(AControl.Controls[i] as TCustomEdit).Text:='';
end;
if AControl.Controls[i] is TCustomComboBox then
begin
(AControl.Controls[i] as TCustomComboBox).ClearSelection;
end;
//可以作为父亲的控件处理事件。
if AControl.Controls[i] is TCustomControl then
begin
ClearText(AControl.Controls[i] as TCustomControl);
end;
end;
end;
//清空当前界面所有文本框过程
procedure ClearText(AControl:TWinControl);
var I : Integer;
begin
for I := 0 to AControl.ControlCount - 1 do // Iterate
begin
//需清空处理控件
if AControl.Controls[i] is TCustomEdit then
begin
(AControl.Controls[i] as TCustomEdit).Text:='';
end;
if AControl.Controls[i] is TCustomComboBox then
begin
(AControl.Controls[i] as TCustomComboBox).ClearSelection;
end;
//可以作为父亲的控件处理事件。
if AControl.Controls[i] is TCustomControl then
begin
ClearText(AControl.Controls[i] as TCustomControl);
end;
end;
end;