J
Jon Skeet [C# MVP]
I've got two combo boxes which are somewhat linked - the second one is
only valid if the first one has a certain value.
When I change the first one to a different value, I want to deselect
whatever's in the second box, leaving it blank. It's definitely
possible, because the databinding does is when we first enter the form
- the value is DBNull, and it manages to clear the box.
According to the docs, setting the SelectedIndex to -1 should do it -
but it doesn't. It just sets the index to 0 instead. However, bizarrely
enough, setting the SelectedIndex from the command window in the
debugger does exactly the right thing.
Any suggestions as to what might be going on?
only valid if the first one has a certain value.
When I change the first one to a different value, I want to deselect
whatever's in the second box, leaving it blank. It's definitely
possible, because the databinding does is when we first enter the form
- the value is DBNull, and it manages to clear the box.
According to the docs, setting the SelectedIndex to -1 should do it -
but it doesn't. It just sets the index to 0 instead. However, bizarrely
enough, setting the SelectedIndex from the command window in the
debugger does exactly the right thing.
Any suggestions as to what might be going on?