Typically when you press the Enter key while typing in a TextBox control, you will hear the computer beep.

To prevent this beep, handle the Enter key in the KeyPress event, and set the Handled property to true. For example:

      void TextBox_KeyPress( object sender, KeyPressEventArgs e )
          switch (e.KeyChar)
              case 'r':
                  // perform necessary action
                  e.Handled = true;

Share and Enjoy:
  • Digg
  • Twitter
  • Facebook
  • Reddit
  • StumbleUpon
  • LinkedIn
  • Google Bookmarks
  • Slashdot