How to programmatically shift focus to the next control (Views: 100)
How to programmatically shift focus to the next control
To shift focus from one control to the next in the tab order without using the tab key, set the KeyPreview property of the parent form to True and drop the following into the OnKeyPress of the first control (and every control you want to "exit" with the [programmer specified] key).
if Key = chr(XXX) then
SendMessage(form1.Handle, WM_NEXTDLGCTL, 0, 0);
XXX = the ASCII code of a Key (e.g. ENTER = 13)
<< Back to main page