I am adding objects from classes that are derived from UserControl to a ComboBox control. This is really useful since I can access the desired control directly from the drop-down list.
All this works fine, except that all ComboBox entries are empty strings (the derived UserControls behind it are fully accessible using selectedItem) ...
ComboBox uses DropDownList as a drop-down style, but changing it does not eliminate it.
Minimal working example showing blank lines:
public class TestControl : UserControl { public override string toString(){ return "Example"; } } ... combobox.Items.Add(new TestControl()); ...
When i call
combobox.Items.Add(new TestControl().ToString());
record "Example".
Is this a bug in the ComboBox control, or am I doing something wrong? thank you
source share