I'm trying to bind a combobox to a value in data set I navigate through using a binding navigator.
I have a form, and some textboxes binded to a dataset through a binding navigator.
the binding to a textbox is simple:
this.catActualTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.myBindingSource, "CatActual", true))
It works perfect, but I need to change one of theese textboxes with a combobox. The textboxes show numbers (keys) and I want to show the related descriptions (values). So I use a combobox. I load the combobox with a DataTable, wich has two colums "IdCatActual" (the keys) and "Descrip" (the values). It shows correctly in the form, but it does not update when navigate:
this.catActualComboBox1.DataSource = myDataTable; this.catActualComboBox1.DisplayMember = "Descrip"; this.comboBox1.DataBindings.Add(new System.Windows.Forms.Binding("SelectedItem", this.myBindingSource, "CatActual"));
Finally I got the answer.
I was using the wrong porperty. I must bind "SelectedValue" property instead "SelectedItem" property.