(page requirements)

How to clear multiple edit controls without having to refer to them one by one

So your new form has 40 edit controls, and now you're looking for a quick and easy way to clear all of them without having to refer to them one by one. How about using a function like this:

procedure TForm1.Button1Click(Sender: TObject);
var
  i : integer;
begin
  for i := 0 to ComponentCount-1 do
    begin
      if( Components[ i ] is TEdit )then
      begin
        (Components[ i ] as TEdit).Text := '';
      end;
  end;
end;

 
 
Applicable Keywords : Components, Delphi, Delphi 1.x, Delphi 2.x, Delphi 3.x, Functions, Source Code
 
 
 
Copyright © 2009 Chami.com. All Rights Reserved. | Advertise | Created in HTML Kit editor