Databound ComboBox Losing its value on .EndEdit

I have a databound combobox that works just fine when I select any of it's values with the mouse.  The SelectedIndex value returns a 1 before and after the bindingsource.EndEdit.  However, if a user tabs into the combobox and uses the down arrow to select the first value in the combobox, the SelectedIndex value is 1 before the bindingsource.endedit and a zero after the .EndEdit ... Whats this means is that the combobox will not save the value during a new record add.  Please tell me what might be the problem here.
LVL 2
MrFantastic6Asked:
Who is Participating?
 
CodeCruiserCommented:
Add an event handler for the SelectedIndexChanged and see if it fires when the value is changed with arrow key.
0
 
ZhaolaiCommented:
The SelectedIndex for the first value in the combobox is 0, not 1.
0
 
edemcsCommented:
Make sure you're not doing a postback when leaving the list.  If you're in an updatePanel, you may be unknowingly posting back to the server and the default is being reset to one.

I've had cases where I was explicitly setting the default value somewhere in my code, a postback would occur, and the default value would be reset.
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
MrFantastic6Author Commented:
Sorry I meant to specify that I'm using vb .net 2008 windows forms.
0
 
MrFantastic6Author Commented:
The selectedIndexChanged is firing.  The text value is also pointing to the correct value.  The first entry in the combobox is a blank value which is the zero selectedindex.  The 2nd value in the dropdown is index 1 and the text changes to "Widget".  When I hit the save button, everything is working great until the bindingsource.EndEdit gets fired.  The selectedIndex reverts to 0 and the text in the combobox also reverts to blank.  Now if you use the mouse to make all the selections, everything works just fine.  Very bizarre stuff.
0
 
edemcsCommented:
Look into the stack trace window while stepping through and verify that the mouse isn't being handled while the key is not.
0
 
edemcsCommented:
I'd take a look if you provide the code...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.