Massive Clear

Please discuss general Delphi programming topics here.

Massive Clear

Postby sepehr » February 11th, 2007, 7:55 am

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
User avatar
sepehr
Active Member
Active Member
 
Posts: 23
Joined: October 4th, 2006, 6:38 am
Location: Karaj

Postby sepehr » February 11th, 2007, 8:04 am

for j := 0 to ComponentCount-1 do
if (Components[j] is TEdit) then
(Components[j] as TEdit).Text := '';

:roll: I found it out!
User avatar
sepehr
Active Member
Active Member
 
Posts: 23
Joined: October 4th, 2006, 6:38 am
Location: Karaj

Postby Kambiz » February 11th, 2007, 3:30 pm

It's better to use ControlCount and Controls properties instead of ComponentCount and Components.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2424
Joined: March 7th, 2003, 7:10 pm


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron