Link to home
Start Free TrialLog in
Avatar of Tim313
Tim313Flag for United States of America

asked on

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?

Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Pressing the Enter key after selecting the value with Space should save the value.
Avatar of Tim313

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial