I want to use a string value like this
Random rnd = new Random();
int x= rnd.Next(1, 10);
string ime = "pictureBox" + x.ToString();
ime.BackColor = Color.CornflowerBlue;
but that doesnt work
Instead of generating a random name and using it do find the PictureBox with that name, directly pick a random PictureBox:
Random rnd = new Random();
var pictureBoxes = frm.Controls.OfType<PictureBox>().ToArray();
var randomPictureBox = pictureBoxes[rnd.Next(pictureBoxes.Length)];
randomPictureBox.BackColor = Color.CornflowerBlue;
stringis not aPictureBox.. therefore, aBackColorproperty does not exist.