我有一个标准的文本框。我添加了以下代码以使用户能够按 Ctrl + a 来选择RTB中的所有文本:
Private Sub tb_teamList_KeyDown(sender As Object, e As KeyEventArgs) Handles tb_teamList.KeyDown
If e.Control = True AndAlso e.KeyCode = Keys.A Then
tb_teamList.SelectAll()
End If
End Sub
现在,当用户按 Ctrl + a 时,它仍然会发出蜂鸣声。有没有办法让按键按下时不发出哔哔声?
答案 0 :(得分:0)
好的是在多行TextBox中按Ctl + A时禁用哔声,您需要在代码中添加e.SuppressKeyPress = True
:
Private Sub tb_teamList_KeyDown(sender As Object, e As KeyEventArgs) Handles tb_teamList.KeyDown
If e.Control = True AndAlso e.KeyCode = Keys.A Then
tb_teamList.SelectAll()
e.SuppressKeyPress = True
End If
End Sub