BLOG.CSHARPHELPER.COM: Use a loop to load pictures into PictureBoxes in C#
Use a loop to load pictures into PictureBoxes in C#
When the form loads, it builds the path to the image files. It then creates an array holding references to the form's PictureBoxes. (If you use this array in more than once place, you can declare it at a module level so you don't need to recreate it later.)
The program then loops through the items in the array, loading the corresponding pictures named pic0.png, pic1.png, and so forth.
Comments