Select to view content in your preferred language

Referencing controls

750
2
08-02-2010 10:34 PM
AtinLangoAL
New Contributor
I can easily reference controls in a form from within an event of the form e.g. form load event. But I cannot reference a control from within an event of another control on the same page or form. Help is much needed on how to do this.
Tags (3)
0 Kudos
2 Replies
EricHajek1
Regular Contributor
What I think you're asking is:

You reference a control in a form without issue, such as a button click firing-

ThisEvent.Object (gives a reference to the button)
or if it was the form's onload, the same thing would give a reference to the form itself.

So you want to reference a different control than the one that is getting its event fired, which could be done like this:

ThisEvent.Object.Parent.Controls("ControlName")

Adding the .Parent gives you a reference to the page (one heirarchy level up), or form (two heirarchies up) if you were to do:

ThisEvent.Object.Parent.Parent

Then you could get a reference to the form, and once you can reference the form, access the other controls / pages the usual ways.

Hope this helps,
Eric
0 Kudos
AtinLangoAL
New Contributor
Thanks Eric. I already got it yesterday!


ThisEvent.Object.Parent.Controls


I wish you had come my way before. I realy suffered with this for close to 2 weeks.
0 Kudos