Results 1 to 5 of 5

Thread: Annoying 'Beep' in a textbox

  1. #1

    Thread Starter
    Hyperactive Member RealNickyDude's Avatar
    Join Date
    Nov 2002
    Location
    Watching you through the hidden camera :o
    Posts
    435

    Annoying 'Beep' in a textbox

    I have it so i can recognise when the Enter key is pressed inside a text box, but how do I stop the annoying beep?
    Last edited by RealNickyDude; Feb 16th, 2003 at 09:17 PM.
    [vbcode]
    On Error GoTo Hell
    [/vbcode]:¬) Nicky : Why not try VBCodebook.NET.

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    for me it's working ,
    VB Code:
    1. Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
    2.  
    3.         If (Asc(e.KeyChar())) = 13 Then
    4.             e.Handled = True
    5.         End If
    6.  
    7. End Sub

  3. #3
    Lively Member
    Join Date
    Jan 2002
    Posts
    105
    Yeah, this works for me too without the beep. Just a slightly different way of doing it compared to the other one.

    Code:
    Private Sub txtDataFormat_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtDataFormat.KeyPress
    
            'Ceck if enter was pressed
            If e.KeyChar = Microsoft.VisualBasic.ChrW(13) Then
                e.Handled = True
    
                'Is this textbox active or not?
                If (Me.txtDisplay.Enabled = True) Then
                    'Ok go here then
                    Me.txtDisplay.Focus()
                Else
                    'No it's not so move to the command button instead
                    Me.cmdClose.Focus()
                End If
            End If
    
        End Sub

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Your way is good if you are moving focus to other control otherwise it's as same as mine

  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Nicky is your textbox set to multilines ?If so , then you would be in trouble I guess

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