How to Detect the "TAB" Key is Pressed

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Prabhudhas Peter

    How to Detect the "TAB" Key is Pressed

    How to Detect the "TAB" Key is pressed in the Text Box or Combo Box....
    Which events catches the TAB key...
    I Want to perform some operations when the "TAB" key is pressed...
    --
    Peter...
  • Herfried K. Wagner [MVP]

    #2
    Re: How to Detect the "TAB&qu ot; Key is Pressed

    "Prabhudhas Peter" <PrabhudhasPete r@discussions.m icrosoft.com> schrieb:[color=blue]
    > How to Detect the "TAB" Key is pressed in the Text Box or Combo Box....
    > Which events catches the TAB key...
    > I Want to perform some operations when the "TAB" key is pressed...[/color]

    Add this to your form's code:

    \\\
    Protected Overrides Function ProcessTabKey( _
    ByVal forward As Boolean _
    ) As Boolean
    MyBase.ProcessT abKey(forward)
    MsgBox("Tab key was pressed!")
    End Function
    ///

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

    Comment

    • Jorge Serrano [MVP VB]

      #3
      RE: How to Detect the &quot;TAB&qu ot; Key is Pressed

      Hi,

      I suggest you use the next code:

      Private Sub TextBox1_KeyUp( ByVal sender As Object, ByVal e As
      System.Windows. Forms.KeyEventA rgs) Handles TextBox1.KeyUp
      If (e.KeyCode = Keys.Tab) Then
      MessageBox.Show ("Tab Key")
      End If
      End Sub

      With this code, you'll receive the feedback when the user has pushed the Tab
      key and the focus has been received by the TextBox Control.

      I hope that helps.

      Kind regards,

      Jorge Serrano Pérez
      MVP VB.NET


      "Prabhudhas Peter" wrote:
      [color=blue]
      > How to Detect the "TAB" Key is pressed in the Text Box or Combo Box....
      > Which events catches the TAB key...
      > I Want to perform some operations when the "TAB" key is pressed...
      > --
      > Peter...[/color]

      Comment

      Working...