<div class="gmail_quote">On Mon, Feb 22, 2010 at 4:12 PM, Curt Hagenlocher <span dir="ltr">&lt;<a href="mailto:curt@hagenlocher.org">curt@hagenlocher.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div>You want args.Key instead of e.Key. The standard event signature is function(object sender, EventArgs args)</div></blockquote><div><br>Tried that, but got runtime error saying that it was being called w/3 arguments, and only two were specified. Adding &quot;self&quot; as first argument worked, however.<br>

 </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div></div><div>But the better way to do this is to set the OK button to be the default button. In Winforms, this is a property on the form:</div>


<div>form.AcceptButton = self.ok_button.<br><br></div></blockquote><div><br>tried this approach as well (self is the login dialog): <br><br>ok_button == self.control(&quot;btnOk&quot;) // xaml name for it<br>ok_button.Click = self.on_ok<br>

self.AcceptButton = ok_button<br><br>but no event seemed to be triggered on it. Anyway, the on_enter handler works once I sorted out the arguments properly.<br>Ken<br></div></div>