Cannot bind to the new display member in ComboBox

后端 未结 9 764
迷失自我
迷失自我 2021-01-01 21:14

I have a class which give me this error

public class Item 
{
    public string Name;
    public int Id

    public Item(string name, int id) 
    {
        N         


        
9条回答
  •  长情又很酷
    2021-01-01 21:30

    if (lstItems.Count > 0)
    {
        comboBox1.DataSource = lstItems;
        comboBox1.DisplayMember = "Name";
        comboBox1.ValueMember = "Id";
    }
    

提交回复
热议问题