Why Label controls aren't being hit in a foreach loop if the Label is in a GroupBox?

c#, winforms

Solution

SetLabels (this);

public void SetLabels(Control ctrl)
{
  foreach (Control c in ctrl.Controls)
     {
         SetLabels(c);
         if (c is Label)
         {
             if (c.Text == "12/31/1600")
             {
                 c.Text = "Not Found";
             }
         }
     }
}

Problem

Label controls aren't being hit in a foreach loop if the Label is in a GroupBox. If the Labels are outside of a GroupBox they are. How can I get my loop to find them? ``` foreach (Control c in this.Controls) { if (c is Label) { if (c.Text == "12/31/1600") { c.Text = "Not Found"; } } } ```

Original source