Emulate tab key

0
0

It is possible to exit a textbox with the enter key and go to the next textbox?

  • You must to post comments
0
0

Use the window level accelerator event. You can assign the enter key as an accelerator. Add the select next control function in the accelerator event. This will then allow all child controls of the form / page to respond to the enter key. You will need to precede the next control function if you want to respond to say button click events, as the accelerator is evaluated first. Simply test if the button has focus, if it has then call button click event, then exit the sub before executing the next control function. This is much faster than key up event.

  • Jesús Sanz
    It’s a good idea, thanks.
  • You must to post comments
0
0

Ok, it works,
but I wonder is it the best way to do it ?, I have read that keyup is in the lazy events of wisej.

Could it be done in javascript?

My clients are very used to using enter to switch textboxes.

  • You must to post comments
0
0

Hi Jesus,

yes you can use the exact same code as you would in WinForms.
e.g. attach to the KeyUp event of your text box and use the following code

if (e.KeyCode == Keys.Enter)
   SelectNextControl(sender as Control, true, true, true, true);

Best regards
Frank

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.