change components property

hi
i have these codes and they work correctly but i can't use it into another forms

var CLS:integer;
begin
for CLS := 0 to ComponentCount-1 do
  begin
    if (Components[CLS] is TEdit) then
      TEdit(Components[CLS]).Text := '';
    if (Components[CLS] is TComboBox) then
      TComboBox(Components[CLS]).Text := '';
  end;

i mean , i wanna write a procedure that i can call it in another forms , the codes which are written on above work just in the form that i write them on it
how can i change it to use in all my forms
tanxfull
Mahsa
Mahsa60Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kretzschmarCommented:
procedure WhatEver(AOtherForm : TForm);
var CLS:integer;
begin
for CLS := 0 to AOtherForm.ComponentCount-1 do
  begin
    if (AOtherForm.Components[CLS] is TEdit) then
      TEdit(AOtherForm.Components[CLS]).Text := '';
    if (AOtherForm.Components[CLS] is TComboBox) then
      TComboBox(AOtherForm.Components[CLS]).Text := '';
  end;
end;

meikl ;-)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kretzschmarCommented:
btw. the usage

whatever(Form1);
whatever(Form2);
whatever(Form3);
whatever(Form4);
.....

meikl ;-)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.