Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > ComboBox behaviour
 

ComboBox behaviour

Hi Folks,

I'm a basic learn as you go type hobby programmer I guess.
I'm designing a program that tracks staff performances within a call centre environment. Nothing too major with the design - radios, text, rich text, combobox and command buttons. I'm having trouble with the combobox behaviour.

I have setup the combobox with the click option - code below. This worksperfect with the mouse, however if I utilise the down arrow on keyboard, it selects the first name and sets focus to the rich text (like as though the mouse was clicked). Isthere a methodin treating thedown key behaviour to keep scrolling down the list, so that the enter key(or mouse click) performs the selection and then sets focus to the next section?

Private Sub OpName_Click()
Descr.Enabled = True
Descr.SetFocus
End Sub

Appreciate your efforts with your reply.
Yobbo01  Tuesday, August 11, 2009 11:37 PM
Which event, specifically, are you calling this method from now? The Click event? Or the SelectedIndexChanged event? Or the SelectionChangeCommitted event?


www.insteptech.com ; msmvps.com/blogs/deborahk
We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!
DeborahK  Tuesday, August 11, 2009 11:52 PM
Which event, specifically, are you calling this method from now? The Click event? Or the SelectedIndexChanged event? Or the SelectionChangeCommitted event?

I've only called the click event.
Yobbo01  Wednesday, August 12, 2009 5:24 AM
Hi Yobbo01,

Could you please provide more information or a code snippet about the ComboBox. As far as I know, the basic behavior of the ComboBox is correct: it would move to the next item if we press the down arrow on keyboard. You need to trace the key events, such as KeyDown, KeyPress or KeyUp, to trace the key processing. From my experience, when you press the down arrow, some events, such asClick,might be fired and cause an item be seledted on ComboBox.

Best regards,
Aland Li
Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Thursday, August 13, 2009 9:02 AM
Hi Aland Li,

"From my experience, when you press the down arrow, some events, such asClick,might be fired and cause an item be seledted on ComboBox."

That's exactly what I'm experiencing. Ideally I'm after a user friendly solution for both keyboard and mouse orientated people. The mouse side of things was covered off perfectly, however it impacts the keyboard side somehow (the concept doesn't make sense really). I've tested double click on a ComboBox, however the mouse side doesn't work, but the keyboard worked perfectly.

Private Sub OpName_Click()
Descr.Enabled = True
Descr.SetFocus
End Sub

Thinking about some alternatives - Perhaps a clickorarrow presson the name and press enter - where the enteris the triggerfor the activity.
I have done the following which seems to work...
Private Sub OpName_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case 13
Descr.Enabled = True
Descr.SetFocus
End Select
End Sub

Still would love to knowthe answer to the 'click' issue.

Thanks for your time.
Yobbo01  Thursday, August 13, 2009 11:09 PM
Move of the time I use SelectedIndexChanged or the Validated events. The first one fires also when the combo box is databound. The Validated is just fired just before the Lost Focus event.
Please click 'Mark as Answer' on the post that helped you.
DamPee  Monday, August 17, 2009 12:21 PM
Hi Yobbo01,

You can use the DropDownClosed event to track the item selecting.

Regards,
Aland Li


Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Tuesday, August 18, 2009 2:53 AM

You can use google to search for other answers

Custom Search

More Threads

• New Controls without enterprise edition
• CheckedListBox Control does not display bound data!
• TRACK A THREAD WITH A PROGRESSBAR
• Server to Client Chat only
• Deployment/Installation
• datagridview cellvaluechanged event
• can I use a datagridView combobox column when using RAD databinding?
• Re-Bind Datagridview when current row is not active
• Binding to static dropdownlist
• how to insert an image into Ms access database using c#