Results 1 to 4 of 4

Thread: [RESOLVED] [2005] Disable beep when hitting Enter in vb.net

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2005
    Posts
    30

    Resolved [RESOLVED] [2005] Disable beep when hitting Enter in vb.net

    I've tried using:
    VB Code:
    1. e.handled = true
    in the keydown and keypress functions, but that doesn't work.

    I've also researched it decently well and found this interesting thread:
    Old Thread Here

    However, nothing there seemed to work either!

    Anyone know of a sure fire way to simply turn the beep off on single-line textboxes when the user presses enter?

    Thanks!

  2. #2
    Frenzied Member
    Join Date
    Mar 2005
    Location
    Sector 001
    Posts
    1,577

    Re: [2005] Disable beep when hitting Enter in vb.net

    Is VB 2005 really so different that this won't work?
    VB Code:
    1. Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
    2.         If e.KeyChar = Chr(13) Then
    3.             e.Handled = True
    4.         End If
    5.     End Sub
    If you just use
    VB Code:
    1. Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
    2.         e.Handled = True
    3.     End Sub
    is it so, that you can't enter anything but you still hear the beep when you press enter?
    VB 2005, Win Xp Pro sp2

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 2005
    Posts
    30

    Talking Re: [2005] Disable beep when hitting Enter in vb.net

    oh wow. you are right.

    I was so close, yet so far away.

    I used it alone in the keypress which was disallowing everything so I immediately stopped and went onto the next idea without realizing that if I did:
    VB Code:
    1. If e.KeyChar = Chr(13) Then
    2.             e.Handled = True
    3.         End If

    then things work!

    Thanks a lot!

  4. #4
    Addicted Member
    Join Date
    May 2006
    Posts
    226

    Re: [RESOLVED] [2005] Disable beep when hitting Enter in vb.net

    Thanks so much for having this answer ready for me! Only problem is that I couldn't find this page until I came directly to vbforums.com! Down with Google! Why wouldn't this page (which SHOULD exactly match my search terms) show up? Guess I'll be coming straight here from now on.

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