我有一个带有KeyPress事件的文本框,当按下Enter键时它会更改为其他文本框,并且直到我从Visual Studio的属性面板中添加了自动完成属性,例如:
AutoCompleteCustomSource:集合
[自动完成模式:建议添加
AutoCompleteSource:CustomSource
现在自动完成功能有效,但是当我按Enter时,它不会更改为另一个文本框。
也许您可以改用事件KeyDown
。在我的测试中效果很好。
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
textBox2.Focus();
}
}