How to unselect a combobox ???

  • Thread starter Thread starter Chris Zopers
  • Start date Start date
C

Chris Zopers

Hello,

I can't seem to unselect comboboxes in VB.NET.
I've set the datasource, valuemember and displaymember properties of the
combobox. The first item from the datasource is always selected in the
combobox, even when I set the SelectedIndex property to -1.

I've read the common used solution that setting the SelectedIndex
property twice to -1 should work:

ComboBox.SelectedIndex = -1
ComboBox.SelectedIndex = -1

But that solution doesn't seem to work either!!!

In the load event, nothing helps to unselect comboboxes. When I use
SelectedIndex = -1 in a button-event, it works just fine, but all
comboboxes should be unselected right after loading the form.

Does anyone have a good solution for this problem?

Greetings,
Chris.
 
Hi there,

I just tried ComboBox.SelectedIndex = Nothing, but the first item from
the datasource is still selected.

I can't find the combobox member 'ClearSelected'! I'm using Visual
Studio 2002, maybe 'ClearSelected' is only available in higher versions?

Greetings,
Chris
 
Chris Zopers said:
I just tried ComboBox.SelectedIndex = Nothing, but the first item from
the datasource is still selected.

Set 'SelectedIndex' to -1 twice.
 
Back
Top