VB.net中获取键盘Enter键方法

 1  .net
 2  private void txtIDFromPrint_KeyPress(object sender, KeyPressEventArgs e)
 3         {
 4             if (e.KeyChar == '\r')
 5             {
 6                 txtIDToPrint.Focus();
 7             }
 8         }
 9 VB.NET
10     Private Sub txtIDFromPrint_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtIDFromPrint.KeyPress
11         If e.KeyChar = Microsoft.VisualBasic.ChrW(13) Then
12             txtIDToPrint.Focus()
13         End If
14     End Sub

 

posted @ 2020-10-24 15:59  它的眼角开过光  阅读(658)  评论(0编辑  收藏  举报