Is the Windows Forms AcceptButton behavior in effect when the referenced button is disabled?
-
06-09-2019 - |
Question
With the following:
this.AcceptButton = this.OKButton;
this.OKButton.Enabled = false;
... will the OK button click handler still be invoked when the user presses Enter?
Solution
No, it won't be invoked.
OTHER TIPS
No, when the button is disabled, it will not activate and trigger that event.
-Adam
AcceptButton/CancelButton just call the button's PerformClick() method... which doesn't run if the control is disabled.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow