Home All Groups Group Topic Archive Search About

Unable to remove Beep on Alt+A

Author
3 Nov 2006 4:42 PM
Paul
I created a sample Project with a basic form and one text box.  I put
"e.Handled = True" on every KeyDown, KeyPress and KeyUp event for both
the Form and the TextBox.  When I run the app, and press the Alt+A (or
any Alt+character) button, it beeps (very annoying).  Does anyone know
why and how to fix it?

Author
4 Nov 2006 2:51 PM
Cor Ligthert [MVP]
Paul,

There is a very old answer that was always done by Armin Zingler in past in
this newsgroup.

http://groups.google.com/group/microsoft.public.dotnet.languages.vb/msg/509f0dc571012f2d

If this is not the right have than a search yourself than for Armin Zingler
on Google in this Newsgroup.

However, I hope this helps direct.

Cor

Show quoteHide quote
"Paul" <pwh***@hotmail.com> schreef in bericht
news:1162572161.473595.198260@i42g2000cwa.googlegroups.com...
>I created a sample Project with a basic form and one text box.  I put
> "e.Handled = True" on every KeyDown, KeyPress and KeyUp event for both
> the Form and the TextBox.  When I run the app, and press the Alt+A (or
> any Alt+character) button, it beeps (very annoying).  Does anyone know
> why and how to fix it?
>
Author
16 Nov 2006 3:44 AM
aclauson
I had the same problem, except I needed the beep removed on the entire
form.  One possible way is to put a Menu Strip on the form and set
visible to false if you don't use it.

The solution I found was to set e.SuppressKeyPress to True after
handling the form's KeyDown event.  So your code would look something
like:

Private Sub frm_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        If e.Alt AndAlso e.KeyValue = Keys.A Then
                <EXECUTE ALT-A CODE HERE>
                e.SuppressKeyPress = True
        End If
End Sub

The form will still beep when you hit another Alt combination that is
not explicitly handled and then the args keypress suppressed as above.

Drew

Cor Ligthert [MVP] wrote:
Show quoteHide quote
> Paul,
>
> There is a very old answer that was always done by Armin Zingler in past in
> this newsgroup.
>
> http://groups.google.com/group/microsoft.public.dotnet.languages.vb/msg/509f0dc571012f2d
>
> If this is not the right have than a search yourself than for Armin Zingler
> on Google in this Newsgroup.
>
> However, I hope this helps direct.
>
> Cor
>
> "Paul" <pwh***@hotmail.com> schreef in bericht
> news:1162572161.473595.198260@i42g2000cwa.googlegroups.com...
> >I created a sample Project with a basic form and one text box.  I put
> > "e.Handled = True" on every KeyDown, KeyPress and KeyUp event for both
> > the Form and the TextBox.  When I run the app, and press the Alt+A (or
> > any Alt+character) button, it beeps (very annoying).  Does anyone know
> > why and how to fix it?
> >