Then access your Control Collection
of your Actual Container.If it is GroupBox
use:
groupBoxname.Controls
Instead of this.Controls
.If your container is TableLayoutPanel
then use tableLayoutPanelname.Controls
and so on.
Question
I have an array of 20 images, and 20 picturebox, I tried displaying those images in the pictureboxes and this code made it worked:
for (int x = 1; x <= ExtractedBoxes.Count(); x++)
{
((PictureBox)this.Controls["pictureBox" + x.ToString()]).Image = ExtractedBoxes[x - 1];
}
But when I placed all my picture box inside a groupbox or a tablelayoutpanel it doesn't show. I want them inside a groupbox or a tablelayoutpanel so it they will be organized.
Solution
Then access your Control Collection
of your Actual Container.If it is GroupBox
use:
groupBoxname.Controls
Instead of this.Controls
.If your container is TableLayoutPanel
then use tableLayoutPanelname.Controls
and so on.