I pasted your following codes on keypress event of form
DOCASECASE nKeyCode = 27 AND thisform.pageframe1.visiblethisform.pageframe1.visible = .F.
CASE nKeyCode = 27 AND NOT thisform.pageframe1.visibleThisform.Release()
ENDCASE
But in the both cases it release the FORM1. First case still does not work. Please help again