首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

keypress事件中 接收回车键 会有声音,该怎么解决

2012-08-13 
keypress事件中 接收回车键 会有声音Private Sub Text2_KeyPress(Index As Integer, KeyAscii As Integer)

keypress事件中 接收回车键 会有声音
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

[解决办法]

与代码无关,查看 Windows 的主题或声音设置。回车键缺省是有声音的。

热点排行