Hi Mark,
It appears (from looking at the event tracking log) that ESC is treated differently to other keypresses.
When the form's KeyPreview property is set to .F. and any key (other than ESC) is pressed, it is processed by the active control, however when ESC is pressed it is processed by the active control and then by the form.
I haven't come across this before so maybe someone else will shed some light on this behaviour, if they can. In any case, testing explicitly for the KeyPreview state in the form's KeyPress event will work eg ....
If nKeyCode = 27 and This.KeyPreview Then
Thisform.Release
Endif
HTH
Liam
>hi again. thanks for reply. this trick works fine for combobox outside grid. but this trick is not working for any combobox inside grid. If you have any idea please give me some hint w asap. Thanks again in advance.
>
>mark
Liam O'Hagan
MCP VFP Desktop Apps