Backspaces and Form Focus

I have two questions:

  1. When using the Backspace key to delete content in a text box, the control is passed to the preceding text box once all data is erased. Can this be disabled?
  2. When calling one form from another, the form to be loaded doesn’t receive the focus; thus the user has to click on the form first before using the form. How do I correct this?

To prevent loss of focus when pressing Backspace once all data has been erased, put the following code into the KeyPress Event of the textbox:

 LPARAMETERS nKeyCode, nShiftAltCtrl*-- If textbox value is empty and the *-- backspace key was pressed, ignore*-- the keyIF EMPTY(this.Value) AND nKeyCode = 127   NODEFAULTENDIF

Regarding the focus issue, you may want to call the SetFocus() method of the called form to make sure that it receives focus.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: