title: How to restrict Combobox to Add Duplicate Values?
body: <p>I have A Class which is used to add Values to Combobox(One is used for display and other as Hidden)</p>
  
  <pre><code>public class ComboBoxItem
      {
          string displayValue;
          string hiddenValue;
  
      //Constructor
      public ComboBoxItem(string displayVal, string hiddenVal)
      {
          displayValue = displayVal;
          hiddenValue = hiddenVal;
      }
  
      //Accessor
      public string HiddenValue
      {
          get
          {
              return hiddenValue;
          }            
      }
      //Override ToString method
      public override string ToString()
      {
          return displayValue;
      } 
  </code></pre>
  
  <p>Using this class i add Values to Combobox</p>
  
  <pre><code>cmbServerNo.Items.Add(new ComboBoxItem(strIPAddress, iConnectionID.ToString()));
  </code></pre>
  
  <p>But i want to restrict duplicate values i am using the below approach</p>
  
  <pre><code>foreach (KeyValuePair&lt;int, Object&gt; ikey in m_lstConnectionID)
              {
                  if (!cmbServerNo.Items.Contains(strIPAddress))
                  {
                      cmbServerNo.Items.Add(new ComboBoxItem(strIPAddress, iConnectionID.ToString()));
                  }
              } 
  </code></pre>
  
  <p>But it Guess it Adds both strIpAddress and ConnectionID so when i check it contains it fails.
  How to resolve this problem ?
  Thanks  </p>