title: Properly disposing/closing an user control
body: <p>I have a Windows Form screen with a menu bar docked at the left-hand side on the form, similar to the one of Outlook 2003, and a panel taking the rest of the right-hand side of the form.</p>
  
  <p>My left menu contains items.
  Upon clicking on those items, I want to load the appropriate user control (acting as "sub-forms") on the right-hand side panel.
  I have managed to do that and it is working well.</p>
  
  <p>The worry I have though is whether or not my usercontrols are being disposed properly or if they remain on memory when the user clicks another menu item (and as such, loads another usercontrol/subform).</p>
  
  <p>The code is similar to this:</p>
  
  <pre><code>    private void ultraExplorerBar1_ItemClick(object sender, Infragistics.Win.UltraWinExplorerBar.ItemEventArgs e)
      {
          panel1.Controls.Clear();
  
          if (e.Item.Key == "Action")
          {
              ActionUserControl subForm = new ActionUserControl();
              panel1.Controls.Add(subForm);
              subForm.Show();                
          }
          else if (e.Item.Key == "Options")
          {
              OptionsUserControl subForm = new OptionsUserControl();
              panel1.Controls.Add(subForm);
              subForm.Show();
          }
      }
  </code></pre>
  
  <p>I am not sure if the panel1.Controls.Clear() I'm calling at the beginning of the method is enough for the usercontrols not being used anymore to be garbage-collected in due-time?</p>
  
  <p>To my understanding, there shouldn't be any reference left to it in the application once cleared from the panel but I am not sure if I should be doing something else or of a reasonably lightweight tool I could use to confirm that my subforms are disposed as they should and that it doesn't cause some kind of memory/resources leak?</p>