I have a pictureBox that I want to specify by combining two other strings. Lets say the pictureBox was called Tile20 what would I do? How do I make this work?:
if("Tile" + "20".Tag == "Hello")
{
rest of the code...
}
I have a pictureBox that I want to specify by combining two other strings. Lets say the pictureBox was called Tile20 what would I do? How do I make this work?:
if("Tile" + "20".Tag == "Hello")
{
rest of the code...
}
Try it like this:
PictureBox pictureBox = (PictureBox)this.Controls.Find(string.Concat("Tile","20")).FirstOrDefault();
if (pictureBox != null)
{
if (pictureBox.Tag == "Hello")
{
rest of the code...
}
}