Link to home
Start Free TrialLog in
Avatar of dmoore2
dmoore2

asked on

Disabling sound

I am using a form with multiple text boxes. I have entered code for a keypress event that accepts the Enter key, which moves focus to the next text box. When the app is running and I press  the Enter key to step to the next text box, I hear the selected windows sound for an error. If I press the Tab key, I do not get the sound. I do not want to turn the sound off in the Windows control panel - sounds. How can I disable the sound at the instant I press the Enter key? I do not want to disable the sound entirely, when the app is running.
Avatar of Vbmaster
Vbmaster

Set KeyCode = 0 in the KeyDown event.
But only when KeyCode = 13 of course. ;)

If (KeyCode = vbEnter) Then
  KeyCode = 0
  'You have your setfocus code here perhaps?
End If

ASKER CERTIFIED SOLUTION
Avatar of adityau
adityau

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial