>Hi,
>I want user to press the HOME key to set focus to the first edit box control in the form.
>
>The following code not work.
>
>
>ON KEY LABEL HOME thisform.txtCusno.SetFocus()
>
You don't say what the error is (if any). I suspect ThisForm is not available in the context of ON KEY LABEL. The help for that command says "Note that ON KEY LABEL operates outside of the scope of a form; the KeyPress event can be used within forms to execute code when a key is pressed."
KeyPress/KeyPreview are the preferred way to do this sort of thing. In your case you would:
- set the Form's .KeyPreview property to .T.
- in the Form's .KeyPress( ) method have code like this:
LPARAMETERS nKeyCode, nShiftAltCtrl
IF nKeyCode = 1
NODEFAULT
This.txtcusno.SetFocus( )
ENDIF
Further information at
http://fox.wikis.com/wc.dll?Wiki~KeyPress~WIN_COM_API .
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up