windows forms iterate through all controls

C#
private void LoopThroughControls(Control parent)
{
    foreach (Control c in parent.Controls)
    {
        if (c.GetType() == typeof(YourType)) {
            //Do stuff
        } else {
            LoopThroughControls(c);
        }
    }
}
Source

Also in C#: