How to delete object from combobox?

前端 未结 6 1960
遇见更好的自我
遇见更好的自我 2021-01-25 18:37

I have a combobox with objects of Foo type, here is the Foo class:

public class Foo
{
    public string name { get; set; }
    public s         


        
6条回答
  •  借酒劲吻你
    2021-01-25 18:49

    These 2 commands will remove an item from your data source.

    list.Remove((Foo)comboBox1.SelectedItem);
    

    or

    list.Remove(list.Find(P=>P.name == comboBox1.SelectedText));
    

提交回复
热议问题