Solved

textbox keypress event beeping ?!?!?!

Posted on 2007-03-20
3
446 Views
Last Modified: 2008-01-09
I have two panels:   one being a search panel & one holding a datagrid.

I have put a keypress event on the one text field ....

Private Sub txtIDnum_KeyPress(ByVal sender As System.Object,
                                                    ByVal e As System.Windows.Forms.KeyPressEventArgs)
                                                    Handles txtIDnum.KeyPress
        If e.KeyChar = Chr(13) Then
            PerformCustomerSearch()
        End If
End Sub

When I press the Enter key, the customer search works fine, but its beeping as if it's erroring out somewhere.   If I press the Search button though, no beeps.  

The odd thing is that on my "login" form, I do the very same thing and I have no problem ... the only difference is that when i do the keypress event on the login form, all it does is close that one and open the main form whereas the even i'm having trouble with just populates and displays a datagrid on a different panel.  

Any help would be greatly appreciated!  :)

- Travis -
0
Comment
Question by:trs28
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 250 total points
ID: 18757233
To get rid of the Beep...set e.Handled = True:

    Private Sub txtIDnum_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtIDnum.KeyPress
        If e.KeyChar = Chr(13) Then
            e.Handled = True
            PerformCustomerSearch()
        End If
    End Sub
0
 

Author Comment

by:trs28
ID: 18757474
That did it!   Thanks!   ....but why does it beep there, but not when I try to trap that key on the login dialog I'm using?!?
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 18757509
Maybe because you close that form?...not really sure though.  =\
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question