I have a combobox on my form. It’s in DropDown mode and it has autocomplete. When it is first shown, its text is "Choose part...". I would like it to reset its text to this after a selection is made. I’ve tried this (assuming the combobox is named comboBox1):
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
// [omitted]
comboBox1.Text = "Choose part...";
}
It only works when the selection is made using the keyboard (e.g. type a value and press [Enter] or start typing, use the arrows to select one of the autocorrect values, and press [Enter]). When the selection is made using the mouse, the text remains the value selected.
I’ve had problems with keyboard & mouse doing different things with comboboxes before, but that had to do with certain events not firing. I’m sure that this event is firing (the omitted code above runs regardless of the method used).
Has anyone seen this before? Any solutions?
Try using a delegate instead:
And as Hans commented, this probably is not considered the best UI implementation with how users come to expect a
ComboBoxto work.