Bound ComboBox grabbing wrong value
Posted on 2011-02-10
My ComboBox isn't storing the right value to the database. I'd like to show the user the item description but store the item's code to the database
I have the DisplayMember set to the item description and the ValueMember set to the item's code, but it stores what I have in DisplayMember instead of what I have in ValueMember. Whichever field is showing in the ComboBox is what is saved to the database.
I've tried switching them around, but it always saves to the database whatever is shown.
I've tried doing it in code instead of by setting the properties and the same thing happens.
Can there be something else that I have set wrong that would cause this?