I need to programmatically cancel the dropdown of a ToolStripDropDownButton in the DropDownOpening event. However I cannot figure out a way to achieve this.
Asked
Active
Viewed 902 times
0
-
2Is there any particular reason you cannot disable the button when the operation is not valid? – Fredrik Mörk Aug 03 '12 at 11:52
-
Which is indeed the best way, there's no support for canceling it. – Hans Passant Aug 03 '12 at 12:03
1 Answers
0
You can either do nothing in the opening event, or disable the control so I can't be interacted with to even generate the opening event:
toolStripDropDownButton.Enabled = false
http://msdn.microsoft.com/en-us/library/system.windows.forms.toolstripitem.enabled

Peter Ritchie
- 35,463
- 9
- 80
- 98