I have 28 edit boxes on a form. I want to clear the Text property of all of them (eg. EditBox1.Text :=''). Is there a way to do this globally without having to reference each individual box?
procedure TForm1.ClearEdit;
var
j: Integer;
nComp : Integer;
begin
nComp := ComponentCount -1;
if nComp >= 0 then
begin
for j := 0 to nComp do
begin
if Components[j] is TEdit then
begin
(Components[j] as TEdit).Text := '';
end;
end;
end;
end;
If there are any TEdit in the Form that you don't want to clear, you can use the Tag property to identify them.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.