title: Having trouble transferring ListBox items while excluding items that already exist
body: <p>I am creating an application in which the user selects a car model from a dropdown list, which will cause a ListBox of available features to populate from a database. The user has the option to select single features, select all features, remove a feature, or remove all features, which will transfer these features back and forth from the features available ListBox to the features selected ListBox. I have everything working fine but am having a hard time adding just the features from the features available list that don't already exist in the features selected list.</p>
  
  <p>My C# code behind:</p>
  
  <pre><code> protected void btnSelectAll_Click(object sender, EventArgs e)
          {
              for (int i = 0; i &lt; lbOptionsAvailable.Items.Count; i++)
  
                  if (lbOptionsSelected.Items.Contains(lbOptionsAvailable.Items[i]))
  
                  {
                      lbOptionsSelected.Items.Remove(Items[i].ToString());
                  }
                  else
                  {
                      lbOptionsSelected.Items.Add(lbOptionsAvailable.Items[i].ToString());
  
                  }
          }
  </code></pre>
  
  <p>This works fine if I try to add all the items when all the items are already selected but it won't add all the remaining items while excluding items that already exist if certain items already exist in the selected features list.</p>