Problem Scenario
==============
1) Run the application select 100 from combo drop down and you will see "Selection Changed" messagebox coming up.
2) Now click the button "Set Combo Value" see combo text now changed to 25.
3) Now again try to set combo value to "100" from drop down and notice interestingly nothing will happen and combo would still remain at value 25.
How can i avoid this strange behavior?
Plese suggest.
Thanks,
Anurodh
Last edited by anurodhora; June 3rd, 2009 at 05:18 AM.
There are two parts to a combobox of this style - the edit box portion and the droplist portion.
You are changing the edit box portion, but not the droplist portion. The SelectionChanged event fires when the SelectedIndex property changes (which is part of the droplist portion). This doesn't occur because, although you can the visible text, the SelectedIndex remains set to the index of the "100" value.
So what you need to do is add the value to the Items list and then set the SelectedIndex to the added item.
Well, it will then move away me from my original aim i.e.
"My aim is not to fire selection changed event when combo value is changed through code"
What should i do in this scenario, i want both selection changed should not fire when combo text is set and at the same time it should honour selection changed i.e. should get to value the user chooses from the combo drop down.
Bookmarks