Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Trying to get the enter key to not make noise

Trying to get the enter key to not make noise

Scheduled Pinned Locked Moved Visual Basic
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tuningd
    wrote on last edited by
    #1

    Hello, The code works but the when you use the Enter key the program Beeps at me and I would like to stop that but still move to the next control. Private Sub controls_KeyDown(ByVal Sender as object, BayVal e as Systes.Windows.Forms.KeyEventArgs) Handles combobox.KeyDown, textbox.KeyDown If e.keyCode = Keys.Enter Then Me.SelectNextControl(Ctpe(Sender, Control), True, True, True, False) End If End Sub I have also tried many variations of code that is in the if block like SendKeys.Send("{TAB}") still makes the Beep Thank you Dale Burmeister

    D M 2 Replies Last reply
    0
    • T tuningd

      Hello, The code works but the when you use the Enter key the program Beeps at me and I would like to stop that but still move to the next control. Private Sub controls_KeyDown(ByVal Sender as object, BayVal e as Systes.Windows.Forms.KeyEventArgs) Handles combobox.KeyDown, textbox.KeyDown If e.keyCode = Keys.Enter Then Me.SelectNextControl(Ctpe(Sender, Control), True, True, True, False) End If End Sub I have also tried many variations of code that is in the if block like SendKeys.Send("{TAB}") still makes the Beep Thank you Dale Burmeister

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      The Enter and Tab keys are making noise because they are not valid keypresses at the time. Do you have all of your controls TabStop properties set to False? There is a condition setup somewhere that is making the default keyboard handlers (not your handlers!) in the form think that the keypress is not valid and, therefore, generates a beep to signal such an error. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      T 1 Reply Last reply
      0
      • D Dave Kreskowiak

        The Enter and Tab keys are making noise because they are not valid keypresses at the time. Do you have all of your controls TabStop properties set to False? There is a condition setup somewhere that is making the default keyboard handlers (not your handlers!) in the form think that the keypress is not valid and, therefore, generates a beep to signal such an error. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        T Offline
        T Offline
        tuningd
        wrote on last edited by
        #3

        The Tab key work just fine and does not Beep the Enter key Beeps only when it exits the if statement. All the TabStop properties on the ComboBoxes and TextBoxes set to True. The GroupBoxes the house the Combo and TextBoxes to do not have a TabStop properties (I think they are false all the time). The only other event that I have code in is SelectionChangeCommitted for the ComboBoxes and that I use to change a bunch of other things when it happens. I don't think I have any setup condition that touches the default keyboard handlers. Also the wired thing is that the Tab key does not fire the keyDown Event. Thank you for you help Dale Burmeister

        1 Reply Last reply
        0
        • T tuningd

          Hello, The code works but the when you use the Enter key the program Beeps at me and I would like to stop that but still move to the next control. Private Sub controls_KeyDown(ByVal Sender as object, BayVal e as Systes.Windows.Forms.KeyEventArgs) Handles combobox.KeyDown, textbox.KeyDown If e.keyCode = Keys.Enter Then Me.SelectNextControl(Ctpe(Sender, Control), True, True, True, False) End If End Sub I have also tried many variations of code that is in the if block like SendKeys.Send("{TAB}") still makes the Beep Thank you Dale Burmeister

          M Offline
          M Offline
          MohammadAmiry
          wrote on last edited by
          #4

          Try using the following code instead, it should work! (I haven't checked if it works or not.)

          Private Sub controls_KeyDown(ByVal Sender as object, _
          BayVal e as Systes.Windows.Forms.KeyEventArgs) Handles combobox.KeyDown, textbox.KeyDown
          If e.keyCode = Keys.Enter Then
          e.Handled = True
          Me.SelectNextControl(Ctpe(Sender, Control), True, True, True, False)
          End If
          End Sub
          
          T 1 Reply Last reply
          0
          • M MohammadAmiry

            Try using the following code instead, it should work! (I haven't checked if it works or not.)

            Private Sub controls_KeyDown(ByVal Sender as object, _
            BayVal e as Systes.Windows.Forms.KeyEventArgs) Handles combobox.KeyDown, textbox.KeyDown
            If e.keyCode = Keys.Enter Then
            e.Handled = True
            Me.SelectNextControl(Ctpe(Sender, Control), True, True, True, False)
            End If
            End Sub
            
            T Offline
            T Offline
            tuningd
            wrote on last edited by
            #5

            Yep just tried it still a beep also the SelectNextControl returns a Boolean and that also gives me a beep. Thank you for you help Dale Burmeister

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups