Связанный combobox не соответствует объектам списка
I'm new to C# but not to programming. I've been toying around with VS, becoming more comfortable with the language and got stuck on a combobox bound to an int datatable column of an in-memory dataset. I worked on a DataGridView and had no problems creating a DataGridViewComboBoxColumn and populating its dropdown list using a custom class comprised of Key:int and Desc:string. ValueMember = Key, DisplayMember = Desc. DataSource is set to a BindingList<> populated with the list objects. Pick from the combobox and save changes works fine in the grid. Then I moved to a ComboBox. Both the grid and the ComboBox have the exact same BindingSource. So yes they point to the same row at the same time. I bind the ComboBox with cbCtrl.DataBindings.Add( "Text", myBindingSource, ColDBName ); Without populating the dropdown items of the ComboBox, I see the raw int value show up in the ComboBox. I change rows using the grid and the ComboBox value changes too. So it's good. Then I hook up BindingList<> to provide the dropdown list of items in the ComboBox (the same as the grid's column tied to the same column) and it's trouble. The raw int value (eg 19) does not get matched to the proper "Key" item in the dropdown list of the ComboBox. I've tried DropDownStyle = DropDown & DropDownList but no luck with either. And I've looked for hours trying to find a fix. There are no events hooked up to the ComboBox. I exepcted automatic hookup of the raw value to the matching "Key" item in the ComboBox's dropdown list. Is there something else to hookup? Frustrating since I expect something minor. Any help would be GREATLY appreciated. Thank you.
Что я уже пробовал:
Я также непосредственно заполнил ComboBox объектами вместо того, чтобы подключать BindingList<> К источнику данных, но поведение остается тем же самым.