title: OK-Cancel Dialog: handling the 'Enter' key press
body: <p>I'm building a <code>Dialog</code> in Winforms. It's got the two OK and Cancel buttons that are there when you create it, which is what I want. In this dialog I also have a <code>TextBox</code> and a <code>Sub</code> (coding in VB.NET) that handles its <code>KeyPress</code> event. I need stuff to happen when the 'Enter' key is pressed.</p>
  
  <p>Now, I've done such <code>KeyPress</code> handling times and times again. This situation, however, is different, because as soon as 'Enter' key is pressed, the dialog automatically assumes you're pressing the 'OK' button, returns a result and closes. In both the Designer and the actual form when running the application, the OK button is highlight, which means is has some kind of a <em>focus</em> (for the lack of a better term) at all times. How can I disable this feature of a dialog? When I debug my code, pressing enter does not even get to the sub handling the <code>KeyPress</code> event. It simply closes the dialog and returns the result, therefore I can't really step through the code and see what happens behind the scenes.</p>
  
  <p>To restate the question, how can I disable this functionality?</p>
  
  <p>Cheers! = )</p>