Combobox DisplayMember & ValueMember Understanding

Posted on 2008-02-05
Medium Priority
Last Modified: 2013-11-26
Hi Experts,

I'm not sure if I understand the meaning of displaymember and valuemember correctly on combobox's but in relation to my MS Access experience, I understand the first is what's displayed in the combobox and the second is what value is used when a selection is made?

I have a windows form that has a bound combobox on it and I have set the datasource to a seperate table which stores the combobox list. I then set the displaymember (and this a string (it's a name)) and the valuemember (which is a unique integer).

This shows the displaymember as required and I can select from the list - but when I attempt to move onto the next record in my dataset it will not. I assume it won't accept the string in the combobox - as it's bound to a field of integer type - and is attempting to store this integer not the valuemember string?

Not sure how well I've explained that!

Any assistance, as usual much appreciated.

Best regards,

Question by:SamB
  • 3
  • 2
LVL 48

Accepted Solution

Jorge Paulino earned 1000 total points
ID: 20822120
>> I attempt to move onto the next record in my dataset it will not
Have you tried to change the selectedindex ?

Can you show us what you got ?

Author Comment

ID: 20822414
Hi jpaulino,

Here's my code:
Me.DmComboBox.DataSource = Me.MasterDataSet1.DMP
Me.DmComboBox.DisplayMember = "dmpsupplier"
Me.DmComboBox.ValueMember = "id"

Me.DmComboBox.SelectedIndex = 1

I've added the selectedindex and changed it from 0 to 1 but no luck - still populates the combobox with the string, but won't allow any changes. I've also noticed that I can scroll through records if I don't touch this combobox, but all the values are showing as the first in the list (which is not correct).

Many thanks,


LVL 48

Expert Comment

by:Jorge Paulino
ID: 20822893
But you see the values ?
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.


Author Comment

ID: 20822917
Yes - I see the values (strings) but as soon as I attempt to select one the form 'locks up' because it seems not to like my selection.
LVL 34

Assisted Solution

Sancler earned 1000 total points
ID: 20824634
Is this linked to yet another datatable?  That is, are you using this combo to put a value in another record?  Is it a "look-up"?  If so, it sounds as though that other table is expecting one datatype and being offered a different datatype.

Do you have any code anything at all like this


If so, can we please see it?


Author Closing Comment

ID: 31428067
Thanks Guys - it was a combination of the two answers.

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses
Course of the Month6 days, 4 hours left to enroll

588 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