Claudio,
The Valid event doesn't occur until just before the control loses focus so your code is never even triggering because the escape key doesn't cause a focus change. Also the text is already gone by time the Valid event fires because it's handled by the baseclass KeyPress behavior. You can use this code in the KeyPress() method instead:
LPARAMETERS nKeyCode, nShiftAltCtrl
if ( nKeyCode = 27 )
nodefault
endif
>In a editbox i accept a text but when press Esc key the text dissapear.
>In de valid method i control this:
>if lastkey() = 27
> messagebox("Presiono Esc",48,"manejo de errores"
>endif
>But i press Esc key and not display this mensaje why ???
>In other text i accept a date when a invalid date is entered the message "invalid date" appear. How i control show not appear this message.