c#中通过事件实现按下回车跳转控件

1 //接受用户输入参数后回车事件
2         private void tb_KeyPress(object sender, KeyPressEventArgs e)
3         {
4             if (e.KeyChar == 13)
5             {
6                 SendKeys.Send("{Tab}");
7             }
8         }
View Code

1.要在需要按回车跳转的控件中加入此事件

2.将需要跳转的控件进行顺序编号 在行为中TabIndex中写上序号

3.加入代码即可

posted @ 2014-12-17 21:21  xzh1993  阅读(679)  评论(0编辑  收藏  举报