On Sun, 30 May 2004 11:09:31 +0200, Tor Lund wrote:
how do i create a function that does "something" every time i press enter. i
have used the form.AcceptButton property but it does not override if a
button has the focus. then enter will ´click the button and not load my
enter "code".
can anybody help `??
tor lund
Hi,
Set the form KeyPreview property to true and add this handler:
private void frmMain_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs
{
if (e.KeyChar == 13)
MessageBox.Show ("Enter pressed!"); // here you call your enter "code"
}
Regards,
Peter