(Using WinForms and .NET Framework 4.8)
I have a form with a number of controls on it, one of which is a DataGridView whose DataSource is linked to a BindingSource. The other controls on the form (mainly textboxes) are bound to the properties of that data-bound item. The form is used essentially for other people to update database records.
However, the GroupedComboBox is used on the form for the user to update an associated item from a linked table. When a new record in the DataGridView is selected, some code runs when BindingSource.OnCurrentChanged is fired on that grid, to re-populate the GroupedComboBox so that it's relevant to the new data-bound item.
However, after assigning a new List / BindingList to GroupedComboBox.DataSource property, somehow the GroupedComboBox.DisplayMember property is then set to an empty string, to which when the framework calls .ToString() on paint, it displays the namespaced object name, rather than the property assigned to DisplayMember.
In debugging, I've added an event listener to GroupedComboBox.OnDataSourceChanged and tried to set the DisplayMember manually, but after stepping over the code, GroupedComboBox.DisplayMember is still an empty string.
GroupedComboBox.ValueMember and GroupedComboBox.GroupMember however are still assigned as from the Designer.
Not sure what's going on.