Bound combo boxes display ID and not Description field
Posted on 2006-04-21
All combo boxes I have on the forms I'm designing display a record id instead of the description. I am using a ScrollBar
with the CurrencyManager moving the position back and forth as one option for record selection. As I scroll through the
table the values of my cmboPaymentTerms.Text changes to each of the record id's. Needless to say the
cmboPaymentTerms.SelectedIndex remains at 0 because they are not being touched. If I click on any of my combo
boxes they contain the appropriate list as specified by the DataSource.
cmboPaymentTerms.DataBindings.Add("Text", dtContact, "payment_term_id")
cmContact = CType(Me.BindingContext(dtContact), CurrencyManager)
.DisplayMember = "Description"
.ValueMember = "payment_term_id"
.DataSource = dtPaymentTerm
cmContact.Position = 10 <----- Hypothetically
cmboPaymentTerms displays 0 instead of "Due on Receipt"
I have read about 10-12 forum posts trying to identify how to deal with this issue but cannot find anything that helps.
Trying to corollate the record id with a row will not work because my record id's are not sequential.
What is the value of .ValueMember? It apparently has no bearing on displaying the proper .DisplayMember.
Would it not make sense to add a combo box property like .Binding where the field specified in .Binding would
synchronize the combo box with the .DataBinding and display the appropriate .DisplayMember?
Please help. Thanks!