no, no databindings
How can I tell what has set it to 0?
When i debug this I see that the selectedindex has a value say 5
then I try to set to -1 and then it is 0.
Seems to a bug in my code somehow i suppose.
My app reads a xml file and abstracts creatng a data form
from this.
What code would be helpful to see? i could give the project source
i guess, only a few files.
rotsey
"Morten Wennevik [C# MVP]" <Mo************@hotmail.comwrote in message
news:op.tury0gjzdj93y5@stone...
On Sun, 01 Jul 2007 08:23:55 +0200, Rotsey
<ma***********@RemoveThis.optusnet.com.auwrote:
>Because the 0 item is a valid item its the frist item inthe list.
I want nothing selected when I set to -1
"Mr. Arnold" <MR. Ar****@Arnold.comwrote in message
news:ek**************@TK2MSFTNGP04.phx.gbl...
>>>
"Rotsey" <ma***********@RemoveThis.optusnet.com.auwrote in message
news:uW**************@TK2MSFTNGP02.phx.gbl...
Hi,
I have a combobox that when I set the SelectedIndex to -1
it sets to 0.
When you do that, it should set the cbo.text to blank with no entry
selected in the dropdown list.
The combobox Items property says there is 20 items in it.
Yeah, ok that's correct. What's the problem?
Anyone know why this could be please?
What's the problem? You're doing things correctly if you don't want the
first enter in the dropdown list to be displayed with the cbo.Text being
blank or null string.
Do you have DataBindings or other pieces of code that may change the
SelectedIndex? Setting SelectedIndex to -1 will clear the selection
(unless it is a dropdown and the user has written new text). If the
SelectedIndex ends up as 0 something else is setting it. It would help if
you could show us the code.
--
Happy coding!
Morten Wennevik [C# MVP]