日期:2014-05-20  浏览次数:20778 次

bindingNavigator1 里的ComboBox无法更改

  private void Form1_Load(object sender, EventArgs e)
  {

  bind();

  txtPriorty.DataBindings.Clear();
  txtPriorty.DataBindings.Add("text", bindingSource1, "Priorty");
  comValid.DataBindings.Clear();
  comValid.DataBindings.Add("SelectedValue", bindingSource1, "Valid");
  comwtID.DataBindings.Clear();
  comwtID.DataBindings.Add("SelectedValue", bindingSource1, "wtID");

  comwtID.DataSource = new BLL.Warehouse().getWarehouseType();
  comwtID.DisplayMember = "TypeName";
  comwtID.ValueMember = "wtID";
  comValid.DataSource = new BLL.Valids().getValid();
  comValid.DisplayMember = "ValidName";
  comValid.ValueMember = "Valid";

  }

  private void bind()
  {

  bindingSource1.DataSource = new BLL.Warehouse().getWarehouse();
  bindingNavigator1.BindingSource = bindingSource1;
  dataGridView1.DataSource = bindingSource1;
 
  }

ComboBox 运行是没错的,但是,想改comValid和comwtID里的值就没法改,因为,只在离开这comValid和comwtID这两个就改回原来的数据

------解决方案--------------------
编程思想不对。

既然知道问题症结所在,就应该能解决。

探讨
ComboBox 运行是没错的,但是,想改comValid和comwtID里的值就没法改,因为,只在离开这comValid和comwtID这两个就改回原来的数据