Combo boxes duplicate entries

前端 未结 4 1249
醉话见心
醉话见心 2021-01-07 01:27

I am adding items to combo box using comboBox.Items.Add(entry);. But how can I avoid duplicate entries (i.e same name entries) in combobox. Is there any lib fun

4条回答
  •  粉色の甜心
    2021-01-07 01:36

    Check for the item before adding:

    if (!comboBox.Items.Contains(entry))
        comboBox.Items.Add(entry);
    

提交回复
热议问题