在vb.net中实现窗体上回车键代替TAB键,用如下方法:
首先设置窗体的 KeyPreview 属性为true
然后加入以下代码:
Private Sub FrmLogin_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
'用回车代替Tab
If e.KeyChar = Chr(13) Then
e.Handled = True
SendKeys.Send("{TAB}")
End If
End Sub
本文地址:http://com.8s8s.com/it/it45098.htm