469,578 Members | 1,212 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,578 developers. It's quick & easy.

how to suppress beep (beep sound)

When I press the Enter key in a Textbox I get a beep sound. But when I press
the Enter key in a combobox, I don't get the beep sound. Is there a way to
suppress the beep? How to do this?

Thanks
Feb 14 '07 #1
4 9174
I've experienced the same thing when I did a quick "command style" textbox
that I wanted to fire off the command entered in the box when you press
enter.. and it all worked good with the exception that it fired off the Beep
sound. Since its basically telling you that you cant create a new line in a
single-line box.

So what I did was making the textbox multiline and use the keydown event to
figure out of I pressed enter and then cleared the textbox and sent the
command.. And since it was a multiline box it didnt complain about the new
line that pressing enter does.

Not sure if you can do the same somehow.. I know its a dirty trick but
worked for me :P I don't know if you're trying to handle something when you
press enter or just want to get rid of the beep.

"Rich" <Ri**@discussions.microsoft.comwrote in message
news:34**********************************@microsof t.com...
When I press the Enter key in a Textbox I get a beep sound. But when I
press
the Enter key in a combobox, I don't get the beep sound. Is there a way
to
suppress the beep? How to do this?

Thanks
Feb 14 '07 #2
Rich,

http://groups.google.nl/group/micros...dc7888442c55c3

I have seen Armin again active last week, so maybe he answers himself

Cor

"Rich" <Ri**@discussions.microsoft.comschreef in bericht
news:34**********************************@microsof t.com...
When I press the Enter key in a Textbox I get a beep sound. But when I
press
the Enter key in a combobox, I don't get the beep sound. Is there a way
to
suppress the beep? How to do this?

Thanks

Feb 15 '07 #3
When I press the Enter key in a Textbox I get a beep sound. But when I
press
the Enter key in a combobox, I don't get the beep sound. Is there a way to
suppress the beep? How to do this?
I believe there is a windows issue with beeps and the enter key. Try
running without the min/restore/close feature in the window (ie set the
form's ControlBox=false). This may (no promises) stop the beep when you hit
the enter key, but you will have a window without a control box in the upper
right corner. Put the control box back (ControlBox=true), and the beep will
return. In theory, there is a way to have ControlBox=true and have a
beep-less enter key. You intercept WM_MENUCHAR, and return MNC_CLOSE from
the window procedure. I have never tested this, so once again, no promises.
I think the beep is a windows response to a failed menu access key or
something like that.

What I do is live with the beeps because I want a ControlBox true and I want
to keep things simple.

Feb 17 '07 #4
There are NO windows issue with beeps and the enter key.

If you press the Enter key in a TextBox that is NOT MultiLine then you will
get a beep. This is by design because you can't enter a newline in such a
TextBox.

To suppress, the beep, simply handle the KeyPress event of the TextBox and
if it was the Enter key that was pressed the set e.handled to true before
allowing the event handler to terminate. If you wish some other action to
occur when the Enter key is pressed then put code for that in the same
place.
"AMercer" <AM*****@discussions.microsoft.comwrote in message
news:C0**********************************@microsof t.com...
>When I press the Enter key in a Textbox I get a beep sound. But when I
press
>the Enter key in a combobox, I don't get the beep sound. Is there a way
to
suppress the beep? How to do this?

I believe there is a windows issue with beeps and the enter key. Try
running without the min/restore/close feature in the window (ie set the
form's ControlBox=false). This may (no promises) stop the beep when you
hit
the enter key, but you will have a window without a control box in the
upper
right corner. Put the control box back (ControlBox=true), and the beep
will
return. In theory, there is a way to have ControlBox=true and have a
beep-less enter key. You intercept WM_MENUCHAR, and return MNC_CLOSE from
the window procedure. I have never tested this, so once again, no
promises.
I think the beep is a windows response to a failed menu access key or
something like that.

What I do is live with the beeps because I want a ControlBox true and I
want
to keep things simple.
Feb 18 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by bill_m | last post: by
8 posts views Thread by Marcia Gulesian | last post: by
3 posts views Thread by Thom Little | last post: by
5 posts views Thread by John Lee | last post: by
4 posts views Thread by Ross | last post: by
4 posts views Thread by Shyguy | last post: by
5 posts views Thread by =?Utf-8?B?UmFmYWVs?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.