Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want add two keys selection in text box
please help me to solve this ,following code do not work when i pressed tab

What I have tried:

Private Sub TextBox1_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBox1.KeyDown
     If e.KeyCode = Keys.Enter Then
         TextBox2.BackColor = Color.Coral
         TextBox2.Focus()
         TextBox2.Select()
     ElseIf e.KeyCode = Keys.Tab Then
         TextBox2.BackColor = Color.PaleGoldenrod
         TextBox2.Focus()
         TextBox2.Select()
     End If
 End Sub
Posted
Updated 8-Feb-18 2:14am

1 solution

See the Remarks section at Control.KeyDown Event (System.Windows.Forms)[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900