-2

I'm dealing with the fact that when I clear items in a combobox programmatically, the text do not change and keep the last selected item.

How can I do it?

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
Apalabrados
  • 1,098
  • 8
  • 21
  • 38

2 Answers2

1

Try

comboBox.SelectedIndex = -1;

Or

comboBox.Items.Clear();
comboBox.ResetText();
Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
Beldi Anouar
  • 2,170
  • 1
  • 12
  • 17
0

Another way for combo boxes:

Populate

comboBox1.DataSource = new string[] { "", "bruce", "clark", "tony" };

Clear

comboBox1.DataSource = null;
shadow
  • 1,883
  • 1
  • 16
  • 24