Tag Archives: default button

Set the MessageBox default button in C#

The fifth parameter to MessageBox.Show indicates the default button. The following code shows how the program displays a MessageBox with the second button as the default so it is initially selected when the message box appears. // Display a message … Continue reading

Posted in dialogs, MessageBox | Tagged , , , , , , , , , | 2 Comments

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