ComboBox Select Method

I have a DGV with two combobox columns. Once the DGV is loaded, my first selection in the first combobox is selected by the drop-down. After that, when subsequent comboboxes have focus, I can press the space bar and the selection from the previous combobox is shown. However, if I TAB off of this combobox, the combobox goes blank. I suspect that pressing the spacebar will cause the combobox to show the previous selection, but it does not actually SELECT what is shown in the combobox.

How can I have the combobox actually select what is shown when the spacebar is pressed so it will not go blank when the focus is lost (by TAB or RIGHT/LEFT ARROW) to the next column?

Tim313Asked:
Who is Participating?
 
CodeCruiserCommented:
I think you would need to use a keypress event to make cb realize the selection has changed.
0
 
CodeCruiserCommented:
Pressing the Enter key after selecting the value with Space should save the value.
0
 
Tim313Author Commented:
CodeCruiser,

I would have thought so too, but pressing the Enter key causes the combobox to go blank. Seems the item is being visually shown in the cb on the spacebar press, but the value has not been selected by the spacebar press...

If the cb has focus and I press the spacebar, the previous selected item shows in the cb, I can then up arrow (does not open the drop-list but shows the previous item in the list, highlighted), then down arrow (does not open the drop-list but goes back to my desired item, also highlighted) and tab off the cb to the next column and the cb value is saved.

Any property setting I may have wrong, or do I need to have an event procedure to handle the spacerbar press to select the item prior to the cb losing focus?

Any help is appreciated,

Tim
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.