Tag Archives: AcceptButton

Make a context-sensitive AcceptButton in C#

You’ve probably seen applications, often on web sites, where the action that a form takes when you press Enter depends on the control that has focus at the time. For example, many login pages have a place for you to … Continue reading

Posted in controls, user interface | Tagged , , , , , , , , , | Leave a comment

Perform multiple default actions in C#

Occasionally (but not often!) it’s useful to let a form perform multiple default actions depending on the part of the form that the user is currently using. This example displays the message “Name updated” if you press Enter while updating … Continue reading

Posted in controls, user interface | Tagged , , , , , , , , , , , , | 1 Comment

Perform a default action without an accept button in C#

Normally to give a form a default action, you set the form’s AcceptButton property to a button that should be triggered when the user presses Enter. But what if you don’t want a visible button on the form? You can … Continue reading

Posted in controls, user interface | Tagged , , , , , , , , , , | Leave a comment