DataBinding: ComboBox.Text not updating when SelectedValue changes?

Posted by Rob on Stack Overflow See other posts from Stack Overflow or by Rob
Published on 2010-03-16T18:24:03Z Indexed on 2010/03/19 6:01 UTC
Read the original article Hit count: 416

This is the relevant designer code for the ComboBox:

Me.ProbationComboBox.DataBindings.Add(New System.Windows.Forms.Binding("Enabled", Me.RegistrationBindingSource, "IsRegistered", True))
Me.ProbationComboBox.DataBindings.Add(New System.Windows.Forms.Binding("SelectedValue", Me.RegistrationBindingSource, "ProbationID", True))
Me.ProbationComboBox.DataSource = Me.ProbationBindingSource
Me.ProbationComboBox.DisplayMember = "probation"
Me.ProbationComboBox.ValueMember = "id"

The problem is that when I call RegistrationBindingSource.ResetCurrentItem(), the SelectedValue property is refreshed with the correct value from RegistrationBindingSource.ProbationID(). However, the Text property is not updated.

Until I can figure out the problem with my binding, I've been doing this as a fix:

Me.ProbationComboBox.Text = CType(CType(Me.ProbationBindingSource.Current, DataRowView).Row, RootNamespace.DataSet.probationRow).probation

Any ideas? Your assistance is appreciated!

© Stack Overflow or respective owner

Related posts about combobox

Related posts about display