标签:
1、重写方法 OnShown
1 protected override void OnShown(EventArgs e) 2 { 3 base.OnShown(e); 4 foreach (Control ct in this.Controls) 5 { 6 TextBox tx = ct as TextBox; 7 if (tx != null) 8 { 9 tx.KeyDown += (sender, e_args) => 10 { 11 if (e_args.KeyCode == Keys.Enter) 12 { this.SelectNextControl(tx, true, true, false, true); } 13 }; 14 15 } 16 } 17 }
2、修改TextBox的TabIndex属性
1 this.txt_id.TabIndex = 1 2 this.txt_name.TabIndex = 2; 3 ……
Winfrom 文本框回车进入下一个个单元格(TextBox)
标签:
原文地址:http://www.cnblogs.com/cbread/p/5687221.html