Mega Code Archive

 
Categories / Delphi / Examples
 

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;