I have 2 comboboxes, each are bound to the the same DataTable like so:
channelTypeCB.DataSource = SynergyData.ds.Tables["ChannelTypes"];
channelTypeCB.DisplayMember = "channelType";
channelTypeCB.ValueMember = "channelTypeID";
channelTypeCB.BindingContext = new BindingContext();
newSKChanTypeCB.DataSource = SynergyData.ds.Tables["ChannelTypes"];
newSKChanTypeCB.DisplayMember = "channelType";
newSKChanTypeCB.ValueMember = "channelTypeID";
newSKChanTypeCB.BindingContext = new BindingContext();
When I click a button to insert a record into the database, I use channelType.SelectedValue... which is returning the incorrect value. I have a feeling it has something to do with using the ComboBox sort (which I set in the properties of the control in the design view). Has anyone ran into this problem?
This is programmed for a winforms application using C#
Edit:
For example, my Datatable stores values like:
channelType channelTypeID Web 2 Mailer 3 Catalog 4
This is sorted in the combobox, and when I select the first item (which would be "Catalog" when sorted) the SelectedValue returns 2, when I select the second item it returns 3.... I would have expected "Catalog" to return 4