views:

236

answers:

3

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?

+5  A: 

No, it won't be invoked.

Daniel LeCheminant
+3  A: 

No, when the button is disabled, it will not activate and trigger that event.

Adam Davis
+1  A: 

AcceptButton/CancelButton just call the button's PerformClick() method... which doesn't run if the control is disabled.

R. Bemrose