Hi Tore
ON KEY LABEL are more difficult because the user could hit it more than once, it could fire even when no form is active where it will crash.
>You know how it is, I never use a button for the prupose, so I forgot about it. It's probably even the simplest solution. :-)
>
>>Put a button on the form with .Cancel = .T.
>>
>>>You have at least two options:
>>>ON KEY LABEL ESC thisform.release
>>>Or, a much better solution is to put this in the KeyPress event method
>>>if nKeyCode = 27
>>> thisform.release
>>>endif
>>>Personally I give my customers a last chance to regret, with a timeout. This also goes into the KeyPress event method
>>>DO CASE
>>> CASE nKeyCode = 27
>>> IF MESSAGEBOX('Do you really want to exit the program?',4+16+256,'Obs!',5000)=6
>>> thisform.Release()
>>> ENDIF
>>> CASE morestuff..
>>>ENDCASE
>>>
>>>>ok, thanks I will try and let you know
>>>>by the way...i have a problem with on escape too...i want to release a form when I press ESC.have any ideea