I am trying to do a program where I choose out of 4 pictureboxes with images, that picturebox who has the image from the pixaleted picturebox. I am using a random function and because I don't want the picture to repeat itself, I used a Tag to indicate if the Image where used or not. The problem is that the tag doesn't change. I verified it with a Breakingpoint. I don't know what I have done wrong. Please help me. Thank you.
idx = r.Next(0, 6);
pictureBox1.Image=Pixelate((Bitmap) Images[idx], 40);
idp = p.Next(0, 3);
pictureBoxs[idp].Image = Images[idx];
Images[idx].Tag = "Used";
pictureBoxs[idp].Tag = "Used";
for(int i=0; i<4; i++)
{
if (pictureBoxs[i].Tag != "Used")
{
ind = r.Next(0, 6);
if (Images[ind].Tag != "Used")
{
pictureBoxs[i].Image = Images[ind];
Images[ind].Tag = "Used";
}
}
}
