You can set
AcceptButton[
^] property to the button in your Form what handles the data entered.
And remember, just setting the AcceptButton/CancelButton is not enough. This just tell which button should be invoked on ENTER/ESC. We have to set the DialogResult in the Button handler.
button1.DialogResult = System.Windows.Forms.DialogResult.OK;
button2.DialogResult = System.Windows.Forms.DialogResult.Cancel;
form1.AcceptButton = button1;
form1.CancelButton = button2;
And... (Kim Togo...Don't Repeat Yourself) - Look at this
answer[
^]: