Find Form by its Name

Class library usage, coding and language questions.
khalifa_ah
Posts: 3
Joined: Mon Oct 02, 2006 7:20 am

Find Form by its Name

Post by khalifa_ah » Tue Oct 10, 2006 8:56 am

can you create new method in Class Application to can Find Form by its Name as title and class name

admin
Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Tue Oct 10, 2006 9:47 pm

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