ComboBox clear RRS feed

  • Question

  • I am currently calling the Clear method of my combo box before I repopulate it with different values.
    However, the selected text remains behind.

    What is the preferable way to clear the items, and set the combo box back to a state as if it was just constructed (aside from the positioin, width, and styles). I.E I was it to be clear of items, have selectedIndex = -1, and have no text in its editable field.

    Why doesn't combobox.Items.Clear() take care of that for me?
    Must I do each thing manually?

    combobox.SelectedIndex = -1

    Monday, November 30, 2009 5:25 AM


  • Hi,

    If you set DropDownStyle property of Combobobx to DropDown you should execute different codes to clear Items and text.

    But if you set DropDownStyle property to DropDownList only clearing items will be enough for you.
    Monday, November 30, 2009 5:49 AM