Click here to Skip to main content
16,004,782 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I tried to navigate between textboxes using tab key but its not moving.Can anyone please help me?


[edit - moved from comment]
VB
Private Sub FrmDepMaster_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
    If (e.KeyCode = Keys.Enter) Or (e.KeyCode = Keys.Tab) Then
        System.Windows.Forms.SendKeys.Send("{tab}")
    End If
End Sub

[/edit]
Posted
Updated 22-Oct-12 10:53am
v2
Comments
Devang Vaja 22-Oct-12 6:08am    
hello rachna give tabindex to your controls like all texboxes give tabindex 1 button give tabindex 2 and like you want to navigate
Rachna0309 22-Oct-12 6:26am    
Devang:I already did that but still its not working...
OriginalGriff 22-Oct-12 6:53am    
What is it doing?
What have you done to try an make it work - because it is built in to all apps, and you don't need to do anything...
Rachna0309 22-Oct-12 6:59am    
Private Sub FrmDepMaster_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown

If (e.KeyCode = Keys.Enter) Or (e.KeyCode = Keys.Tab) Then
System.Windows.Forms.SendKeys.Send("{tab}")

End If

End Sub

I have written this code but it is not working...I have given tab index to all textbox.
Maciej Los 22-Oct-12 16:54pm    
Just set a break point inside your procedure and test it. ;)

1 solution

You may take a look at Form.KeyPreview[^]

As mentioned by OriginalGriff, tab navigation should happen automatically without any code on your part.

Best regards
Espen Harlinn
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 19-Nov-12 18:46pm    
That's the trick which is often overlooked, a 5.
--SA
Espen Harlinn 19-Nov-12 18:47pm    
Thank you, Sergey :-D

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