0

Avoid the closing of Menu in the ToolStripCombobox in the Windows application. when i select the items of the combo by using the UP/Down arrow keys the dropdown menu is closed automatically whenever the selection changed. How to avoid that auto closing?

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Tanya
  • 1,571
  • 5
  • 22
  • 33

1 Answers1

1

I cannot reproduce this.

I created a form, added a ToolStrip control to it with some standard items, and then added a ToolStripComboBox to the end. Finally, I added a few items to the combo box for testing purposes.

When I run the application, and toggle the selected item in the combo box using the up/down arrow keys, the combo box does not close automatically. I can move the selection up and down the items in the combo box without ever triggering it to close until I press the Enter key.

What are we doing differently? Please update your question to explain the steps necessary to reproduce the behavior that you describe.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
  • I have reloaded the panel in the WinForm based on the selection. When reload the panel the toolstrip1.Combobox.Dropdown has set to false automatically. If i have set that property manually then the dropped list is closed and again opened. – Tanya Jul 26 '11 at 10:18
  • @Tanya: So then the problem is that you can't modify a combo box without it closing. This is by-design in Windows. The only workaround would be a very ugly one: trying to drop the combo box *back* down once you had completed the update. My suggestion is not to trigger the update until *after* the user has made a selection. This is the typical pattern for this type of control. – Cody Gray - on strike Jul 26 '11 at 10:20
  • Is there any way to avoid the closing event. – Tanya Jul 26 '11 at 10:22
  • @Tanya: It's not an event. The screen can't refresh while a combo box is dropped down. They're not meant to stay dropped down for extended periods of time. They're only meant to be dropped for as long as it takes for the user to make a selection. The fix is to change your validation code not to run until the selection has been confirmed. – Cody Gray - on strike Jul 26 '11 at 10:23
  • oh... ok cody gray.. I will change the validation. Thank you for your quick response – Tanya Jul 26 '11 at 10:25