Page 1 of 1

Getting parent form

Posted: Mon Mar 23, 2009 7:10 pm
by atom
hiya

I have a Unkown control object, and i'd like to get the parent Form object.
I dont see anything in the API that can give me the parent form
Other than doing a search up the tree, is there an easier way ?

Regards

Posted: Tue Mar 24, 2009 3:12 pm
by Support Team
Just use

Form parentForm = yourControl.FindSingle<Form>("ancestor::form");

(this works for the parent form, grandparent form, etc..)

Michael
Ranorex Team

Posted: Tue Mar 24, 2009 5:52 pm
by atom
dont suppose you can write that in VB.NET ?!

Posted: Tue Mar 24, 2009 6:41 pm
by Support Team
Use:

Code: Select all

Dim parentForm As Ranorex.Form = yourControl.FindSingle(Of Ranorex.Form)("ancestor::form")
Jenö
Ranorex Team