How to make Enter on a TextBox act as TAB button

后端 未结 12 2517
迷失自我
迷失自我 2020-12-25 13:10

I\'ve several textboxes. I would like to make the Enter button act as Tab. So that when I will be in one textbox, pressing Enter will move me to the next one. Could you plea

12条回答
  •  礼貌的吻别
    2020-12-25 14:12

    I would combine what Pharabus and arul answered like this:

    private void textBox_KeyPress(object sender, KeyPressEventArgs e)
    {
    if (e.KeyChar == ‘\r’)
    {
    e.Handled = true;
    parentForm.GetNextControl().Focus()
    }
    }
    

    Let me know if this helps! JFV

提交回复
热议问题