You can use Thisfor.Activecontrol to find out whick control has focus.
>
>I am using VFP6. To relase forms I use following codes on form's keypress event
>
>
>IF LASTKEY()=27
> RELEASE THISFORM
>ENDIF
>
>
>Now I want to release form with conditions e.g.
>
>Condition No.1
>
>if control/cursor is in grid and user press esc key then the form must not release.
>
>Contition No.2
>
>if control/cursor is not in grid and user press esc key then the form must release.
>
>What should I do more to apply above conditions.
>
--sb--