scenario: in an MDI-Window, there are more Controls with the same control-name
How can i get a list of these controls ? "FindControlName" returns only the actual focused control.
Manually iterating a list of Form.Controls takes too much time, not practicable
Need it for .Net1.1
FindControlName with more instances of a control in a Form
-
- Posts: 55
- Joined: Thu Aug 23, 2007 12:00 pm
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
-
- Posts: 55
- Joined: Thu Aug 23, 2007 12:00 pm
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
about 10s, there were about 80 controls in the Form
10 sec is too long, can you please post your source code.
Please read also the following thread:
http://www.ranorex.com/forum/why-so-slow-t433.html
Can this be the same problem as yours?
Jenö
Ranorex Team
-
- Posts: 55
- Joined: Thu Aug 23, 2007 12:00 pm
Enable Caching has no effect.
Here the code:
ArrayList al = _obj.Controls;
Trace.WriteLine("control count = " + al.Count);
foreach(Control ctrl in al)
{
if(ctrl.Name == "frmUiWindow")
Trace.WriteLine(ctrl.Name.ToString());
}
DateTime tstop = DateTime.Now;
Trace.WriteLine("elapsed time = " + (tstop - tstart).ToString());
Trace:
control count = 148
frmUiWindow
frmUiWindow
elapsed time = 00:00:16.6091624
Here the code:
ArrayList al = _obj.Controls;
Trace.WriteLine("control count = " + al.Count);
foreach(Control ctrl in al)
{
if(ctrl.Name == "frmUiWindow")
Trace.WriteLine(ctrl.Name.ToString());
}
DateTime tstop = DateTime.Now;
Trace.WriteLine("elapsed time = " + (tstop - tstart).ToString());
Trace:
control count = 148
frmUiWindow
frmUiWindow
elapsed time = 00:00:16.6091624
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
OK, i think the problem is the SleepTime property.
Here is the documentation of the Application.SleepTime property:
Please set this property to 0 (Application.SleepTime=0) and try the same code again.
Jenö
Ranorex Team
Here is the documentation of the Application.SleepTime property:
You can speed up your scripts with the SleepTime properety.Gets or sets the sleep time in milliseconds as an integer value. The current thread will be suspended for the specified sleep time after every command.
Please set this property to 0 (Application.SleepTime=0) and try the same code again.
Jenö
Ranorex Team
-
- Posts: 55
- Joined: Thu Aug 23, 2007 12:00 pm
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact: