Search code examples
c#visual-studio-2003

How to set a windows form's AcceptButton to None at run time


To set a form's AcceptButton at runtime, I'm doing this:

this.AcceptButton = this.btnButtonName;

But can anyone tell me how to clear the form's AcceptButton, something like:

this.AcceptButton = None; 

Thanks.


Solution

  • Try this:

    this.AcceptButton = null;