4
Answers

Erasing multiple pictureboxes

Ask a question
So, I have a random number generator that slects a random location for a picturebox. I also want to have a timer so that everyone 1 minute those images get replaced with other images in random locations. So far I have the random number generator and the images get placed randomly. Great! , but whenever the minute passes those images stay there and instead of getting replaced new pictureboxes appear on top of them. 
 
   
   void RefreshTimer_Tick(object sender, EventArgs e)
   {
   r = 15;
   Button1_Click(this, null);
   MessageBox.Show("Refreshed");
   }
 
   if (r == 15)
    {
   do
   {
   theImage.Image = null;
   r--;
   }
   while (r == 15);
   }
 (PS its 15 because there are 15 images)
 
Why doesn't this work? 

Answers (4)