I have multiple pictureboxes and I need to load random images into them during runtime. So I thought it would be nice to have a collection of all pictureboxes and then assign images to them using a simple loop. But how should I do it? Or maybe are there any other better solutions to such problem?
Using a bit of LINQ:
foreach(var pb in this.Controls.OfType<PictureBox>()) { //do stuff }
However, this will only take care of PictureBoxes in the main container.
1.4m articles
1.4m replys
5 comments
57.0k users