how to do this?

Lets say that i have a procedure like this one:

Form1.DBGrid.......something

and i would like to do this:

aa: some variable;

aa.DBGrid1...., where aa if Form1

and later this:

bb: some variable;

aa.bb... something where aa is form1, and bb is dbgrid1

is it possible and how?
Thanks
                   Robert
LVL 1
rpetruniAsked:
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.

MotazCommented:
I can't understand your quesion, what exactly did you want to do ?
0
MotazCommented:
why did you want to do this ?
0
kifahCommented:
Hi,
YES Just do the follwoing

Type
  Form1 = ......
  .
  .
  .
  Private
  Public
    BB: TDBGrid;
 end;

var
  aa: TForm;
Imp.....

Procedure XYZ........
begin
  aa := Form1;
  aa.bb.ZZZZZZ :=
end;
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

bakry99Commented:
more explain !!
0
Ronald BusterOwnerCommented:
Yes this is possible :

In property inspector change names of

form1 in aa
dbgrid1 in bb

after that you can use

aa.bb :=

regards,

Cono
0

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
rpetruniAuthor Commented:
to Motaz and bakry99:
i want to do this:
procedure TOsnovnaForma.Snimi(Ime:String; broj:Integer;Sender:TObject);
var
   i: Integer;
   IniZaKolone : TIniFile;
begin
     IniZaKolone:=TIniFile.Create(RadniDirektorij + Ime + '.ini');
     for i:=0 to broj - 1 do
     begin
          IniZaKolone.WriteString(Ime, 'Polje: ' + IntToStr(i), SomeForm.DBGrid1.Columns[i].FieldName);
          IniZaKolone.WriteString(Ime, 'Naslov: ' + IntToStr(i), SomeForm.DBGrid1.Columns[i].Title.Caption);
          IniZaKolone.WriteString(Ime, 'Sirina: ' + IntToStr(i), IntToStr(SomeForm.DBGrid1.Columns[i].Width));
     end;
end;
!!! I want  some form, and DBGrid1 to be varible - i want to call this procedure from lots of forms !!!
To cono :
:-)
To cifah:
Your explanation is ok, but only if i try to call this procedure from this form, i need to call it from other forms, and in this situation i don't have acces to components on the form. How to achieve this?  
                         Robert
0
rwilson032697Commented:
You can write your procedure like this:

procedure TOsnovnaForma.Snimi(Ime:String; broj:Integer;Sender:TObject;
TheGrid : TDBGrid);
var
   i: Integer;
   IniZaKolone : TIniFile;
begin
     IniZaKolone:=TIniFile.Create(RadniDirektorij + Ime + '.ini');
     for i:=0 to broj - 1 do
     begin
          IniZaKolone.WriteString(Ime, 'Polje: ' + IntToStr(i), TheGrid.Columns[i].FieldName);
          IniZaKolone.WriteString(Ime, 'Naslov: ' + IntToStr(i), TheGrid.Columns[i].Title.Caption);
          IniZaKolone.WriteString(Ime, 'Sirina: ' + IntToStr(i), IntToStr(TheGrid.Columns[i].Width));
     end;
end;

Then just pass the DBGrid from the form when you call the funcTrion.

Cheers,

Raymond.
0
rpetruniAuthor Commented:
Thanks rwilson
0
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.