I have several textboxes
, i want the cursor to move from one textbox
to another using arrow keys.
how can i do that?
it looks like this, also the tap moves vertically which is weird.
Thanks.
I have several textboxes
, i want the cursor to move from one textbox
to another using arrow keys.
how can i do that?
it looks like this, also the tap moves vertically which is weird.
Thanks.
Just made this off the top of my head creatively. This will give you exactly what you want.
Step 1 create a TableLayoutPanel and make the columns 4 and the rows 5. Delete all your original text boxes and Step 2 add this to your code.
This will allow you to navigate up down left right with the arrow keys and it will fix your issue with the tab so tab will now go right and shift+tab will go back. Additionally this solution is nice because if you go up or down it will cycle back around as you would intuitively expect. Also if you are feeling zesty you can move diagonally now.
Try handling the keypress event
→,← can force tab,shift+tab key press respectively.
Just a rough idea, as I have never tried this.
You can override the form's ProcessCmdKey function, and handle the key press and focusing on text boxes in it.
The following solution works if there is some text in the text boxes.
First create a KeyDown event handler: