Results 1 to 2 of 2

Thread: [RESOLVED] Disable Beeps in Textboxes

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2006
    Location
    Pennsylvania
    Posts
    1,069

    Resolved [RESOLVED] Disable Beeps in Textboxes

    Type something, hit enter, annoying beep comes up. Can someone give me the code to get rid of this annoying beep? Thanks

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Disable Beeps in Textboxes

    That beep is audible feedback that is provided when you press Enter in a single-line TextBox on a form that has no AcceptButton and it indicates that the Enter key will have no effect. If you take that away then the user might expect something to happen when they press Enter and think that your app is broken when it doesn't. If the user knows that Enter has no effect under those conditions then why are they even hitting the Enter key in the first place? If it's an accident then it will only be a rare occurrence so I don't see why it's a problem. I don't think you can change that easily in previous versions but in .NET 2.0 you can do this:
    Code:
            private void textBox1_KeyDown(object sender, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Enter)
                {
                    e.SuppressKeyPress = true;
                }
            }
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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