>>Have you tried the forms keypreview-method?
>
>it works.
>
>in the cmdbutton.keypress
>LPARAMETERS nKeyCode, nShiftAltCtrl
>thisform.zkeypress1 =nkeycode
>
>in the cmdbutton.click
>if !thisform.zkeypress1=13
>return
>endif
>
>but now the mouse click doesn't work.
Not sure why this is in the .NET section, but it appears you're talking only VFP.
Use NODEFAULT to suppress the normal action of KeyPress.
IF m.nKeyCode <> 13
NODEFAULT
ENDIF
Tamar