Combo boxes duplicate entries

前端 未结 4 1270
醉话见心
醉话见心 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

    How about Casting the items to String

    var check = comboBox1.Items.Cast().Any(c => c.ToString() == "test");
    

提交回复
热议问题