title: What does the Tab Control's ContainsKey() method compare against?
body: <p>I want to create a Tab Control that only opens content once.  Each item that is opened needs to check the container to make sure it isn't already being displayed.  I believe the method I want to use is the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.tabcontrol.tabpagecollection.containskey.aspx" rel="nofollow">bool TabControl.TabPages.ContainsKey(string key)</a> method, however it always returns a value of <em>false</em>.</p>
  
  <p>I've created a work-around where I store the object in a separate list that I keep in sync with the tab control, but it feels very wrong.  I have a list in the TabPages property of the control, so I should be able to query against it.</p>
  
  <p>Am I missing a property?  Is my expectation of this method and what it's performing correct?  How do I get it to correctly identify my opened tabs?</p>
  
  <p>Here is some sample code that is similar to what I'm doing:</p>
  
  <pre><code>private void _fillTabControl()
  {
      List&lt;string&gt; keys = new List&lt;string&gt;() { "one", "two" };
      foreach (string key in keys)
          _addTab(key);
  
      bool alreadyOpened = tabControl.TabPages.ContainsKey(keys[0]);
  }
  private void _addTab(string key)
  {
      TextBox textBox = new TextBox();
      textBox.Text = key;
  
      TabPage tab = new TabPage();
      tab.Text = key;
  
      tab.Controls.Add(textBox);
      tabControl.TabPages.Add(tab);
  }
  </code></pre>