65.9K
CodeProject is changing. Read more.
Home

Findcontrol using a non recursive approach

starIconstarIconstarIconemptyStarIconemptyStarIcon

3.00/5 (4 votes)

Oct 17, 2011

CPOL
viewsIcon

40621

public static List<control> FindControls( Control controlTop )
{
    List<control> list = new List<control>();

    list.Add(controlTop);

    for (int i = 0; i < list.Count; ++i)
    {
        list.AddRange(list[i].Controls);
    }

    return list;
}