Private Sub Text2_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then
' Text2(Index + 1).SetFocus '
' SendKeys "{TAB}" '其把这两句都屏蔽了还是有声音
End If
End Sub以前用VB.NET也遇到过,
Private Sub PressEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress, TextBox2.KeyPress, TextBox3.KeyPress
Dim sk As Microsoft.VisualBasic.Devices.Keyboard = My.Computer.Keyboard
If e.KeyChar = ChrW(Keys.Enter) Then
sk.SendKeys("{TAB}")
e.Handled = True 解决办法是加上这一句! VB6中不知道怎么让它不出生
End If
End Sub
If KeyAscii = 13 Then
' Text2(Index + 1).SetFocus '
' SendKeys "{TAB}" '其把这两句都屏蔽了还是有声音
End If
End Sub以前用VB.NET也遇到过,
Private Sub PressEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress, TextBox2.KeyPress, TextBox3.KeyPress
Dim sk As Microsoft.VisualBasic.Devices.Keyboard = My.Computer.Keyboard
If e.KeyChar = ChrW(Keys.Enter) Then
sk.SendKeys("{TAB}")
e.Handled = True 解决办法是加上这一句! VB6中不知道怎么让它不出生
End If
End Sub
与代码无关,查看 Windows 的主题或声音设置。回车键缺省是有声音的。
If KeyAscii = 13 Then
KeyAscii = 0
End If
End Sub但是这样就等效没有回车了。