You've correct code in nKeyCode variable. The LASTKEY() will be updated after .keypress() completes.
>
>In the thisform.keypress(), I have the following code (I have keypreview set to .t.):
>
>
>LPARAMETERS nKeyCode, nShiftAltCtrl
>
>LOCAL tnKey
>tnKey = LASTKEY()
>
>SUSPEND
>
>DO CASE
>CASE tnKey = -4
> THISFORM.cmdValidate.CLICK()
>CASE tnKey = -5
> THISFORM.cmdManual.CLICK()
>CASE tnKey = -6
> THISFORM.cmdCancel.CLICK()
>ENDCASE
>
>
>When I press F5, both the value of tnkey and nLastkey is 42! What gives?
>
>Thanks,
>
>Yossi
--sb--