Default buttons and WinForms

From the "so simple it's obvious" category.. I have an application with a dialog box that provides some search functionality. It consists of a text box where the user types in the word or phrase they want found, and a Find button and a Cancel button.

The problem was that I wanted the user to be able to enter text and press the Enter key - and pressing Enter would be the same as clicking the Find button. And while I was at it, I wanted the Escape key to be the same as clicking the Cancel button.

I searched for quite a while looking for a feature of the Text Edit box control that would do this for me, but I was looking in the wrong place. As pointed out to me, I should have been looking in the properties of the dialog form I was using. Each dialog has an AcceptButton and a CancelButton property: all I had to do was select the button I wanted the Return and Escape keys to trigger, and that was that.