How to Detect the "TAB" Key is Pressed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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...
 
Prabhudhas Peter said:
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...

Add this to your form's code:

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

I suggest you use the next code:

Private Sub TextBox1_KeyUp(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) 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
 
Back
Top