Cant get list of controls properly

Class library usage, coding and language questions.
Posts: 12
Joined: Wed Nov 05, 2008 6:50 pm

Cant get list of controls properly

Post by din2dino » Wed Dec 10, 2008 12:35 am


I have this winforms control, where i am trying to retrive the list of controls and pick the one I want based on index.

However the list of controls returned keeps changing. First time controls in the tab and other tab are also returned. When i call the same code second time, it returns the controls in ony that tab.
hence different number of controls returned.

Any solution? There are no IDs/names of the controls.And all are same class.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12174
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA

Post by Support Team » Wed Dec 10, 2008 11:49 am

Usually, if the state of the application does not change, the order in which controls are returned by Control.Children should not change either. However, the returned children may change if controls are hidden or repositioned. Please, consider that the Control.Children property does not only return the immediate children of the control, but actually all its descendants.

If the tab control you're dealing with is a .Net TabControl, you need to know that controls on a tab page are usually created when the tab page is shown for the first time.

Ranorex Support Team