This Code Will make your application move to the next control by pressing enter.
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress, TextBox2.KeyPress, TextBox3.KeyPress, TextBox4.KeyPress If Keys.Enter Then SelectNextControl(sender, True, False, False, True) End If End Sub
Note that you can add the same event to many controls by using ",". In This Example I have coded on TextBox1 But the event is fired by all the textboxes because i have added these codes Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress, TextBox2.KeyPress, TextBox3.KeyPress, TextBox4.KeyPress
NOTE : That you have to set TabIndex in order. ================================================================================ Download Sample Application. ================================================================================ Regards Hefin Dsouza
AttachmentsDownload Sample (20967-11107-useEnterToMoveNext.rar)
|
No responses found. Be the first to respond and make money from revenue sharing program.
|