Results 1 to 4 of 4

Thread: On Return Stop Beep [RESOLVED]

  1. #1

    Thread Starter
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Resolved On Return Stop Beep [RESOLVED]

    I have a textbox which the user enters a search query into, now when they hit return it searches. So they dont have to move the mouse to hit the search button. But when ever the return key is hit in the textbox its makes a beep sound. Is there a way to stop it making a noise?

    Im using the onKeyDown event of the textbox to capture the key press.

    Thanks
    Last edited by john tindell; Jan 28th, 2005 at 10:30 AM.

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Re: On Return Stop Beep

    Instead of trying to handle the search in the key events of the Textbox, add a Search button, now assign it to the AcceptButton property of the form. Now, whenever the Enter key is pressed, the Search button will be clicked, giving you the same result without having to handle key events.

  3. #3
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142

    Re: On Return Stop Beep

    use the KeyPress Event to stop the Beep ( e.Handled = true for the Enter Key ) eg:
    PHP Code:
            private void textBox1_KeyPress(object senderSystem.Windows.Forms.KeyPressEventArgs e)
            {
                if(
    e.KeyChar == (char)Keys.Enter)
                {
                    
    // stop the Beep like this...
                    
    e.Handled true;
                }
            } 
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  4. #4

    Thread Starter
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Re: On Return Stop Beep

    cheers Aaron that was exactly what i was looking for, thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width