Page 1 of 1

Find Form by its Name

Posted: Tue Oct 10, 2006 8:56 am
by khalifa_ah
can you create new method in Class Application to can Find Form by its Name as title and class name

Posted: Tue Oct 10, 2006 9:47 pm
by webops
Good idea, we will implement this function for a future version.
We have code freeze at the moment, we test the next version 0.9.4 and will release it this week.
But the good news, we implemented a new property ClassName for the Control class and you can find easily a top level window with a specified title and class name in V0.9.4 as follows:

Code: Select all

Form form = null;
Application.GetForms();
foreach (Form topform in Application.Forms)
{
    if( topform.Text == "title" && topform.ClassName == "className")
    {
        form = topform;
        Console.WriteLine("Handle={0} Location={1} Text={2} ClassName={3}",  
                form.Handle, form.Location, form.Text, form.ClassName);
        break;
    }
}
Jenö Herget
Ranorex Team