I am trying to bind a ComboxBox to a foreign key table. I know that on cannot bind to the actual foreign key, SomeTableClassFK, (causes a LinqSql exception when the FK already has a value). So, I am binding to FK object, SomeTable, reference thru the SelectedItem property of the ComboBox.
SomePrimaryTable
SomeTableClassFK —> SomeTableClass.PK
SomeTable ——–> SomeTableClass
this.aComboBox.DataBindings.Add(new System.Windows.Forms.Binding(“SelectedItem”, this.somePrimaryTableBindingSource, “PendingReason”, false));
This isn’t working. The ComboBox always insta-binds the FK object to the first item in its list.
Any ideas?
Ok…Issue was traced to funky winform behavior. Evidently, there is no guarantee that the OnLoad for a user control will not be called more than once. As a consequence, the two tables involved, (see diagram above), were being loaded from different DataContexts. Splat!!