I was wondering how could I select objects which were created during programs runtime. Each object has its unique name. How could I select that object by its name?
Example names:
"mapPart_0_0"
"mapPart_0_1"
"mapPart_0_2"
etc.
It's a windows form project. In c#.
Creation of those objects:
private void addBoxes()
{
for (int a = 0; a < 25; a++)
{
for (int b = 0; b < 10; b++)
{
MyCustomPictureBox box = new MyCustomPictureBox();
box.Location = new Point(b * 23 + 5, a * 23 + 5);
box.Image = new System.Drawing.Bitmap("tiles/0.png");
box.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
box.Size = new Size(24, 24);
box.Name = "mapPart_" + a + "_" + b;
box.Click += new EventHandler(boxClickAdd);
box.oFile = "0";
panel1.Controls.Add(box);
}
}
}