I have many group Boxes in a flow layout panel all are generated programmaticaly. when I try to find any specific groupbox at run time nothing comes out. Here is my code, Please help.
foreach (Control ctr in flowLayoutPanel1.Controls)
{
if (ctr.Name=="BSE")
{
MessageBox.Show("Control is found");
}
}
Code, which creates controls:
var Allzone = (from a in db.Zones select a.name).ToList();
foreach (var z in Allzone)
{
GroupBox g = new GroupBox();
g.Text = z;
g.Name = z;
g.Tag = z;
g.Font = new Font("Verdana", 8,FontStyle.Bold);
g.ForeColor = Color.White;
g.Width = 49;
g.Height = 90;
flowLayoutPanel1.Controls.Add(g);
}