Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ComboBox index needs to be set twice

11 views
Skip to first unread message

Nadav

unread,
Dec 23, 2005, 9:03:42 PM12/23/05
to
Hello.
I have a combobox in a form (cmbNames).
The DataSource property is some arraylist of strings.
I have a button which is supposed to "clean" the combobox and deselect any
item.
Therefore, I do:
cmbNames.SelectedIndex = -1;

If index 0 was selected (meaning, the first item on the list) - the combobox
indeed goes to index -1 and there is no selected item.
if the selected item is not 0, meaning not the first item in the list - the
1st click on the button will select item 0 (the SelectedItem will be 0), and
another click will select nothing.

Why does that happen ?

(I attached a messagebox to the IndexChanged event of the combo, that pops
up the current index. When let's say index 3 is selected, on the click of
the button 2 messageboxes appear, the first saying -1, the second says 0. I
donno why is that!)

10x


Tim Wilson UNDERSCORE AT PERIOD

unread,
Dec 23, 2005, 11:07:09 PM12/23/05
to
It's a bug.
http://support.microsoft.com/default.aspx?scid=kb;en-us;327244

--
Tim Wilson
.NET Compact Framework MVP

"Nadav" <nad...@gmail.com> wrote in message
news:%233toF5C...@tk2msftngp13.phx.gbl...

MuZZy

unread,
Dec 24, 2005, 12:00:48 AM12/24/05
to

Install .NET 1.1 Service Pack
I had a similar problem in combination of combo box and a text box and
SP1 helped

MuZZy

unread,
Dec 24, 2005, 12:02:14 AM12/24/05
to

Wow, it's actually a bug for .NET 1.0 - why not install at least 1.1 SP1 ?

Nadav

unread,
Dec 24, 2005, 7:49:54 AM12/24/05
to
Thanks alot.
I understand that it's not solved at the moment (correct?)
I have Frameworks 1.1


"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in message
news:Or9$z9DCGH...@TK2MSFTNGP10.phx.gbl...

Tim Wilson UNDERSCORE AT PERIOD

unread,
Dec 24, 2005, 9:07:01 AM12/24/05
to
The knowledge base article indicates that this is a problem for 1.0 but it's
also a problem in 1.1. This has been fixed with 2.0.

--
Tim Wilson
.NET Compact Framework MVP

"Nadav" <nad...@gmail.com> wrote in message

news:%23VZROiI...@TK2MSFTNGP12.phx.gbl...

0 new messages