I Have VB.net application form with 10 horizontal text boxes . I need to move between text boxes with right And Left Keyboard Arrow . Also I need Make textBoxes Format To Be Like This 0.00
VB.net move between textboxes by keyboard arrow
2.3k views Asked by user3077945 At
2
There are 2 answers
0
On
I got the following code from the following link:
Private Sub Form1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
' Sets Handled to true to prevent other controls from
' receiving the key if an arrow key was pressed
Dim bHandled As Boolean = False
Select Case e.KeyCode
Case Keys.Right
'do stuff
e.Handled = True
Case Keys.Left
'do other stuff
e.Handled = True
Case Keys.Up
'do more stuff
e.Handled = True
Case Keys.Down
'do more stuff
e.Handled = True
End Select
End Sub
In addition to webdad3's answer.
Don't forget to set Form.KeyPreview to true (via Forms Designer)
For the second part:
There are many, many different ways to format the text of a textbox. The best solution would be to use DataBindings (complex topic, read a book about it.)