Reply to comment
Preventing BackSpace key in a TextBox from moving a cursor to the previous control
Deleting characters in a TextBox with Backspace key doesn't stop when cursor reaches the beginning position but unexpectedly moves cursor to the previous control. It could cause unintended deletion of the data there.
To stop BackSpace key from leaving a TextBox and behave the same way as in other applications, add following code to a TextBox Keypress event. If you're using a Framework, add it to your lowest level TextBox class so it will be inherited by all TextBoxes.
| This is sample code. Add error handling and adjust to your requirements as necessary. |
* TextBox Keypress LPARAMETERS nKeyCode, nShiftAltCtrl IF nKeyCode = 127 AND This.SelStart = 0 AND This.SelLength = 0 NODEFAULT ENDIF
Recent comments
1 week 4 days ago
4 weeks 19 hours ago
4 weeks 23 hours ago
4 weeks 1 day ago
4 weeks 1 day ago
5 weeks 2 days ago
8 weeks 2 days ago
10 weeks 4 days ago
12 weeks 2 days ago
12 weeks 3 days ago