Combobox bug

G

Guest

Hi all,

i have found something odd...when a combobox is not selecting the first value (or ComboBox1.SelectedIndex > 0) and your code executes

ComboBox1.SelectedIndex = -1

it will select the first the value (.SelectedIndex=0) instead of deselecting all values. if you want to make the combobox deselect the first value, you must execute the same line of code again.

maybe i'm missing something, any thoughts?

Thanks in advance,

Kunkel
 
D

Dominique Vandensteen

got that problem little time ago...
and I replied on my own post ;-)
aha
found it...
http://support.microsoft.com/default.aspx?scid=kb;en-us;327244

is a known bug, but seems only to be known for 1.0...
i still have it in 1.1
<<



Kunkel said:
Hi all,

i have found something odd...when a combobox is not selecting the first
value (or ComboBox1.SelectedIndex > 0) and your code executes
ComboBox1.SelectedIndex = -1

it will select the first the value (.SelectedIndex=0) instead of
deselecting all values. if you want to make the combobox deselect the first
value, you must execute the same line of code again.
 
B

Brian Henry

i just got that bug like 20 minutes ago, drove me crazy... im doing a owner
drawn box... and it started comming up when i was refrenceing e.index


Kunkel said:
Hi all,

i have found something odd...when a combobox is not selecting the first
value (or ComboBox1.SelectedIndex > 0) and your code executes
ComboBox1.SelectedIndex = -1

it will select the first the value (.SelectedIndex=0) instead of
deselecting all values. if you want to make the combobox deselect the first
value, you must execute the same line of code again.
 
D

Dominique Vandensteen

I can also add...
my solution was to do a "ComboBox1.SelectedIndex = -1" twice

but pay attention
if you have a selectedIndex or selectedItem listener

for a selectedindex of for example 2 you will receive following events while
doing the =-1 twice
selectedindex -> -1
selectedindex -> 0
selectedindex -> -1



dominique
 
H

Herfried K. Wagner [MVP]

* =?Utf-8?B?S3Vua2Vs?= said:
i have found something odd...when a combobox is not selecting the
first value (or ComboBox1.SelectedIndex > 0) and your code executes

ComboBox1.SelectedIndex = -1

it will select the first the value (.SelectedIndex=0) instead of
deselecting all values. if you want to make the combobox deselect the
first value, you must execute the same line of code again.

BUG: ComboBox Does Not Clear When You Set SelectedIndex to -1
<http://support.microsoft.com/?id=327244>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top