title: if name exists in combo box do not add
body: <p>When adding a name from a sql table to a combo box in WPF, I want to check if the name already exists in the combo box. If it does do not add. My code I have tried that does not work:</p>
  
  <pre><code>        public void display()
      {      
         try
          {             
              sc.Open();
              string Query = "select *from Part";
              SqlCommand createCommand = new SqlCommand(Query, sc);
              SqlDataReader dr = createCommand.ExecuteReader();
              while (dr.Read())
              {
                  String Name = dr.GetString(1);
  
  
  
                  if (cbPartners.Items.Contains(Name) != null)
                  {
                      cbPartners.Items.Add(Name);
                  }
  
                  else
                  {
                     MessageBox.Show("message");
                  }
                  }
  
              sc.Close();
          }
          catch (Exception ex)
          {
              MessageBox.Show(ex.Message);
          }
      }
  </code></pre>