Clear ComboBox selected text

phadaphunk picture phadaphunk · Apr 3, 2012 · Viewed 107.4k times · Source

I have a ComboBox control with the DropDownStyle properties set to DropDownList. Once there is an item selected, how can I clear the selection from the ComboBox without deleting any Items in it ?

I'd normally use something like that:

myComboBox.Text.Clear();

But I can't do that. Any idea how I could clear it ?

Answer

ionden picture ionden · Apr 3, 2012

You could change SelectedIndex property:

comboBox1.SelectedIndex = -1;