0
我想要绑定组合框到数据集中的值我使用绑定导航器进行导航。Combobox绑定不更新
我有一个表单,有些文本框通过绑定导航器绑定到数据集。
到一个文本框的结合很简单:
this.catActualTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.myBindingSource, "CatActual", true))
它的工作完美,但我需要改变与组合框theese文本框之一。文本框显示数字(键),我想显示相关的描述(值)。所以我使用组合框。我用DataTable加载组合框,有两个列“IdCatActual”(键)和“Descrip”(值)。它在表格中正确显示,但在导航时不会更新:
this.catActualComboBox1.DataSource = myDataTable;
this.catActualComboBox1.DisplayMember = "Descrip";
this.comboBox1.DataBindings.Add(new System.Windows.Forms.Binding("SelectedItem", this.myBindingSource, "CatActual"));