dataset中有两个table(t1和t2)
t1: id    name    id1
t2: id1   name
要使combobox在下拉列表中的值为t2.name,当改变combobox中选中的值时更新t1中id1的值.
请问通过数据绑定能实现吗?

解决方案 »

  1.   

    //邦定数据
    this.cb_xb.DataSource = ds.Tables["t2"].DefaultView;
    this.cb_xb.DisplayMember = "name";
    this.cb_xb.ValueMember = "id1";然后再写一个combobox的事件
      

  2.   

    这样只是实现了combobox下拉列表的值绑定t2.name的功能,但怎么实现通过combobox更新t1.id1呢?
      

  3.   

    combobox中的不是有个selectedIndexchanged事件吧,用这个就可以实现呀
      

  4.   

    参看
    http://blog.csdn.net/knight94/archive/2006/04/02/648172.aspx