Bound combo boxes display ID and not Description field

Posted on 2006-04-21
Last Modified: 2010-04-23
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)

        With cmboPaymentTerms
            .DisplayMember = "Description"
            .ValueMember = "payment_term_id"
            .DataSource = dtPaymentTerm
        End With

        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!

Phil Tate
Question by:TSFLLC
    LVL 34

    Expert Comment

    I suggest you try getting rid of this line

            cmboPaymentTerms.DataBindings.Add("Text", dtContact, "payment_term_id")

    LVL 34

    Accepted Solution

    And, having now re-read your post, substitute this instead

            cmboPaymentTerms.DataBindings.Add("SelectedValue", dtContact, "payment_term_id")


    Author Comment


    I'm relatively new to VB.Net.  I've used Access & VBA for years but apparently need to
    review databinding properties a little deeper.  This is exactly what I assumed should be
    available.....a 'one-liner' to display the appropriate value.



    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
    Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now