I am trying to find a solution to replicate what tab does when you are focused on a specific TextBox or MaskedTextBox, I already set my TabIndexs in order through Properties in VS
FormaNalaza is a form
private void FormaNalaza_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
//Switch to the next TabIndex Entity
}
}
This was my solution but I couldn't figure out how to change the focus to the next Entity in the form
I tried SelectNextControl(The starting Entity, 1, 0, 0, 0)
CodePudding user response:
Simple Implementation:
private void FormaNalaza_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
//Switch to the next TabIndex Entity
SendKeys.Send("{Tab}");
}
}
Tab Order
Output:
CodePudding user response:
The tab key does this automatically, so if you are ok with pressing tab instead of enter, you can do that. Changing the TabIndex property of your entities will change the order in which tab will switch between them.


