PUBLIC oMyform oMyform=NEWOBJECT("form1") oMyform.Show RETURN DEFINE CLASS form1 AS form ADD OBJECT cmdCancel AS commandbutton WITH ; Top = 10, ; Left = 256, ; Height = 24, ; Cancel = .t., ; Caption = "Cancel" ADD OBJECT text1 AS textbox WITH ; Left = 10, ; Top = 10, ; Width = 100 PROCEDURE text1.Valid RETURN !EMPTY(this.value) ENDPROC PROCEDURE cmdCancel.Click thisform.Release() ENDPROC ENDDEFINEPress ESC, Note Cancel = .t. in the Button Properties