title: Changing the BackColor of my custom UserControl - help!
body: <p>(<em>lol</em>)</p>
  
  <p>I have a panel on Form1.
  I'm going to add several instances of my custom usercontrol <strong>MovieItem</strong> to that panel.</p>
  
  <p>To do this I'm going:</p>
  
  <pre><code>panel1.Controls.Add(objMovieItem);
  </code></pre>
  
  <p>Now, within the MovieItem.cs code I'm adding the .Click events of everything inside the UserControl so that whenever a user clicks ANYWHERE inside my UserControl, it's background color changes.</p>
  
  <p>Here's the problem:</p>
  
  <p>I have about 10 instances of the UserControl on Form1 (<em>inside of the Panel1 of course</em>). How can I put the BackColor of the selected one to lightblue, and all of the others back to the default color?</p>
  
  <p>Here's my code:</p>
  
  <pre><code>private void SearchMovie()
  {
       //All this does is create an instance of the UserControl and add it to Panel1.
       MovieItem NewMovie = new MovieItem();
       NewMovie.SearchMovie(txtSearch.Text);
       panel1.Controls.Add(NewMovie);
  }
  </code></pre>
  
  <p>Now, inside of my user controls code:</p>
  
  <pre><code>private void MovieItem_Click(object sender, EventArgs e)
      {            
          MainSearchForm MainFormObject = new MainSearchForm();
  
          foreach (Control y in MainFormObject.Controls["panel1"].Controls)
          {
              if (y is UserControl)
              {
                  if (y is MovieItem)
                  {                        
                      y.BackColor = Color.White;
                  }                    
              }
          }
  
          this.BackColor = Color.LightBlue;
      }
  </code></pre>
  
  <p>Here's what happens. The click events are 100% OK. Works as intended. When I click on an object of my UserControl it changes color correctly. But the other don't change back to default. What am I doing wrong.</p>
  
  <p><strong>Thanks SO.</strong></p>