Page 1 of 1

Massive Clear

PostPosted: February 11th, 2007, 7:55 am
by sepehr
i have a form with more than 60 edit boxes and with a procedure i have to clear them all,i wonder if there is a way i can clear all edit boxes at once i mean executing a method on all of Tedit Class Objects That a form contains.
for example clearing all of Tedit Objects that FrmAddMovie contains

Thanks In Advance

PostPosted: February 11th, 2007, 8:04 am
by sepehr
for j := 0 to ComponentCount-1 do
if (Components[j] is TEdit) then
(Components[j] as TEdit).Text := '';

:roll: I found it out!

PostPosted: February 11th, 2007, 3:30 pm
by Kambiz
It's better to use ControlCount and Controls properties instead of ComponentCount and Components.