local oform oform=newObject("asup") oform.show retu DEFINE CLASS asup AS form Top = 0 Left = 0 Height = 243 Width = 375 Caption = "Test keypress on modal form" MaxButton = .F. MinButton = .F. KeyPreview = .T. WindowType = 1 &&modal Name = "Form1" ADD OBJECT text1 AS textbox WITH ; Height = 37, ; Left = 156, ; TabIndex = 2, ; Top = 24, ; Width = 205, ; Name = "Text1" ADD OBJECT command1 AS commandbutton WITH ; Top = 36, ; Left = 36, ; Height = 27, ; Width = 84, ; Caption = "Command1", ; TabIndex = 1, ; Name = "Command1" ADD OBJECT label1 AS label WITH ; AutoSize = .T., ; WordWrap = .T., ; Caption = "F9 works as well in keypress but f10 is a public windows key and select the first menu.dont work in vfp as print screen...", ; Height = 32, ; Left = 12, ; Top = 180, ; Width = 332, ; BackColor = RGB(255,255,128), ; Name = "Label1" ADD OBJECT ylab AS label WITH ; FontSize = 11, ; Caption = "", ; Height = 37, ; Left = 12, ; Top = 108, ; Width = 337, ; ForeColor = RGB(255,0,0), ; Name = "yLab" PROCEDURE KeyPress LPARAMETERS nKeyCode, nShiftAltCtrl thisform.ylab.caption="" if nkeycode=-8 thisform.ylab.caption=this.name+" "+trans(nkeycode)+" f9 pressed" endi if nkeycode=-9 thisform.ylab.caption=this.name+" "+trans(nkeycode)+" f10 pressed" endi ENDPROC PROCEDURE text1.KeyPress LPARAMETERS nKeyCode, nShiftAltCtrl thisform.ylab.caption="" if nkeycode=-8 thisform.ylab.caption=this.name+" "+trans(nkeycode)+" f9 pressed" endi if nkeycode=-9 thisform.ylab.caption=this.name+" "+trans(nkeycode)+" f10 pressed" endi ENDPROC ENDDEFINE * *-- EndDefine: asupas you can see the keypress event (form,textbox) runs as well for f9 key