Click here to Skip to main content
15,946,179 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a structure on my Form like this. Form contains TableLayout, each cell in TableLayout contains Panel, each Panel has a PictureBox and a Label inside it. When the user selects the "Directional Navigation" mode, he/she is given an option to navigate between PictureBoxes on the Form using the Direction Keys. I did automatic shifiting of focus between different picture boxes but haven't been able to do this using direction keys. Please help!

simple set tab index on pictureboxes as per ur navigation sequence.
then set key preview of form to true.
then on keypress event of the form write the following code in

If e.KeyChar = Chr(Keys.Left) Then
Elseif e.KeyChar = Chr(Keys.Right) Then
e.Handled = True
End If

define methodes

Public Sub EnterEqvTabL()
End Sub

Public Sub EnterEqvTabR()
SendKeys.Send("{SHIFT + TAB}")
End Sub
Share this answer
optimus_prime1 10-Oct-10 10:41am    
PictureBoxes don't have TabIndex property. :-|
Toli Cuturicu 11-Oct-10 7:18am    
Very bad answer:
1. TabIndex does not work with PictureBox.
2. The OP wants to use Left, Right, Up, Down Keys.
3. What language is that? Certainly not c# (look at the question tags)
sorry dear,
now if u have fixed no of pictureboxes then focus them using their name property using a array of their names.
like on load focus on pb1
then on left click focus it on pb(x+1) and so on
lese if right then pb(x-1) ....

ok if dynamically u r using picture boxes then u can take a groupbox or a panel where u put/cerate all pic boxes and in a foreach call and set their focus..

is it helpful..
pass a comment
Share this answer
Toli Cuturicu 11-Oct-10 7:19am    
Another bad answer...
And, I almost forgot: No txtspk. Use words, beacuse God gave you Language.

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