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
Solved

textbox keypress event beeping ?!?!?!

Posted on 2007-03-20
3
445 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
  • 2
3 Comments
 
LVL 85

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 85

Expert Comment

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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

808 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