Winform BindingSources - Question

Posted by Stephen Patten on Stack Overflow See other posts from Stack Overflow or by Stephen Patten
Published on 2010-01-15T00:55:04Z Indexed on 2010/06/03 16:44 UTC
Read the original article Hit count: 400

Filed under:
|

I have a windows form (net 2.0) with controls on it bound to an entity (w/ INotifyPropertyChanged) through a BindingSource..works.

On the same form I have a drop down list that is also wired up through a BindingSource..works

Here's a sample of the relevant code:

m_PlanItemLookupBindingSource.DataSource = GetBusinessLogic().RetrievePaymentPlanLookups(); // Collection of PaymentPlans
paymentPlanType.Properties.DataSource = m_PlanItemLookupBindingSource;
paymentPlanType.Properties.DisplayMember = "Name";
paymentPlanType.Properties.ValueMember = "ID";
paymentPlanType.DataBindings.Add(new Binding("EditValue", m_PlanBindingSource, "PaymentPlanID", true, DataSourceUpdateMode.OnPropertyChanged, null, "D"));

agencyComission.DataBindings.Add(new Binding("EditValue", m_PlanBindingSource, "AgencyCommission", true, DataSourceUpdateMode.OnPropertyChanged, null, "P1"));
billingType.DataBindings.Add(new Binding("Text", m_PlanBindingSource, "BillingType"));

So when I change a value in the drop down list I thought that the m_PlanItemLookupBindingSource Current property would change along with the PaymentPlanID property of the entity which does change.

Just a bit confused.

Thanks in advance, Stephen

© Stack Overflow or respective owner

Related posts about winforms

Related posts about databinding