Tabular by pressing the Enter key in c #
If you are in this post it is very likely that your users are more accustomed to tabulate or change the photo pressing ENTER instead of TAB, it is for this reason that in this opportunity we bring you a simple and effective way to do this.
For this example we will create a simple form with 4 textbox and a button.
Then we will look for the TabIndex property and change it according to the order in which we want our focus changes to occur.
Now that we have our indices of change of focus ready. We select all the elements to which we wish to establish the focus with ENTER and create an event by double clicking on KeyUp
The following code will appear
We change the name to one that we understand. (OPTIONAL)
Finally we add the following code:
private void CambiarFoco_KeyUp(object sender, KeyEventArgs e)
if (e.KeyCode == Keys.Enter)
this.SelectNextControl((Control)sender, true, true, true, true);
Important! The fact that we can now tab with ENTER does not mean that the TAB did not work. This example allows both to work.