|
-
Mar 22nd, 2015, 11:37 PM
#1
Thread Starter
Fanatic Member
ComboBox Behavior
I have a combo box on a standard windows form. The combo box is bound to a field from Access table1. The Display Member is a field from the data source table. There is another field from the data source table that is the Value Member. It was my understanding that when the form is run the combo box would display a list of values (from the Display Member field) to select from (the combo box does this). It was also my understanding that the value placed in the bound field would be the value from the Value Member field (it does not do this). It actually inputs the Display Member field value. What am I doing wrong here?
-
Mar 22nd, 2015, 11:44 PM
#2
Re: ComboBox Behavior
At a guess, I'd say that you're using the Text property of the ComboBox, which will return the text displayed in the control, which obviously comes from the property/column specified by the DisplayMember. If you want the value from the property/column specified by the ValueMember then you have to use the SelectedValue property of the ComboBox.
If I've guessed wrongly then you're going to have to actually show us what you're doing rather than describing what you think you're doing.
-
Mar 23rd, 2015, 12:05 AM
#3
Thread Starter
Fanatic Member
Re: ComboBox Behavior
Here is the data properties for the combobox:

fieldA from tableA is binding source. TableB is the Datasource, Field1 TableB is the DisplayMember, and Field2 TableB is the ValueMember
What I was expecting was the Field2 TableB value to be placed in the fieldA tableA value.
-
Mar 23rd, 2015, 12:32 AM
#4
Re: ComboBox Behavior
It's exactly as I said. As you can see from the (DataBindings) section of your properties window, you have bound the Text property rather than the SelectedValue property. Remove the existing binding and add a new binding on the correct property and you'll be good to go.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|