title: Changing panel control from inside the panel
body: <p>I am creating an application using WinForms. I have <code>panel</code> in which I show a <code>user control</code>. Inside this <code>user control</code> I have a <code>button</code>. When I click the button, I want to clear the <code>panel</code> and show a different <code>user control</code>. I am trying to do that using the following code:</p>
  
  <pre><code>private void btnCreateOffer_Click(object sender, EventArgs e)
  {
      var myControl = new WindowsFormsDemo.View.CreateOffer();
      MockUpForm.panMain.Controls.Clear();
      MockUpForm.panMain.Controls.Add(myControl);
  }
  </code></pre>
  
  <p>This works from the buttons placed directly in the parrent form, but when I use in inside the <code>user control</code>, it says:</p>
  
  <blockquote>
    <p><strong>'MockUpForm.panMain' is inaccessible due to its protection level</strong></p>
  </blockquote>
  
  <p>I suppose it has something to do with private/public classes. But I would rather have the "correct" solution, as opposed to just changing everything to public. </p>
  
  <p>Any suggestions on how this is usually done?</p>