开发者

insert object into comboBox

I want to insert an object into comboBox in Win C#, I have 3 items in object. This is my code

List<me开发者_如何学运维t>dyo = new List<met>(); 
dyo=DAL.metpa();
foreach(met t in dyo )
            {
                comboBox1.DataSource = d;
                comboBox1.DisplayMember = t.last_Name;
                comboBox1.ValueMember = t.id_Metp;

            }

and I got this error:

Cannot bind to the new display member.Parameter name: newDisplayMember

What is the problem?


Try

    List<met>dyo = new List<met>(); dyo=DAL.metpa();
    foreach(met t in dyo )
    {
        comboBox1.DataSource = d;
        comboBox1.DisplayMember = "last_Name"
        comboBox1.ValueMember = "id_Metp";

    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜