Page 1 of 1

Error when trying to Find a form in VS2008 with C#

Posted: Thu Feb 26, 2009 10:45 pm
by Ciege
This command works:

Code: Select all

Ranorex.Form HDForm = Host.Local.FindChild<Ranorex.Form>(WindowName);
But I want to use the Timeout ability of Find since FindChild does not have a Timeout ability.

This command results in the error:
"Cannot implicitly convert type 'System.Collections.Generic.IList<Ranorex.Form>' to 'Ranorex.Form'. An explicit conversion exists (are you missing a cast?)"

Code: Select all

Ranorex.Form HDForm = Host.Local.Find<Ranorex.Form>(WindowName);
What am I doing wrong here?

Thanks...

Posted: Fri Feb 27, 2009 10:05 am
by Support Team
The Host.Local.Find method returns a collection (IList) of adapters.

Use following method if you would like to find only a single form element with a timeout:

Code: Select all

Ranorex.Form HDForm = Host.Local.FindSingle<Ranorex.Form>("WindowName",timeout);
Kind regards,
Gabor
Ranorex Support Team