שתף באמצעות


Stop Ding Sound on pressing enter key in vb.net

Question

Friday, August 3, 2012 8:01 AM

I am creating a textbox inheriting the default textbox

I write some code in keypress event like the sample below, sothat user can move to next field by pressing enter key

    SendKeys.Send("{TAB}")

    e.Handled = true

But Ding sound does not stop

I tried it in KeyDown event also

But same results

I have tried e.suppressKeypress also

Can anyone help me?

All replies (3)

Friday, August 3, 2012 8:28 AM ✅Answered | 1 vote

Setting 

    e.suppressKeypress = True

works here. No bing ding dong ring.

Armin


Friday, August 3, 2012 9:36 AM

Have a look at this thread. Maybe the same thing is happening with you? http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/1c98ae86-9ef8-4741-8050-5d26bf9b4cd4

I don't know how to simulate your problem so it's difficult to assist you.

You've taught me everything I know but not everything you know.


Thursday, December 4, 2014 7:16 PM

This replaces the Enter with a space then just trims the space off your string..

Private Sub TextBox1_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs)

 If Asc(e.KeyChar) = 13 Then e.KeyChar = ChrW(32) ' change it to a space

then just use Trim$ to take the space off the string