Solitaire
Well-known member
Suppose I have several textboxes on a form. When user presses Enter, I want the focus to go to the next textbox control on the form. I forgot the exact syntax for this command. It was a one-line instruction using a method that would simply get the next control on the form, in z-order. I had used it in one of my older programs but just can't find it now.
VB.NET:
Private Sub TextBox1_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress, TextBox2.KeyPress, TextBox3.KeyPress, TextBox4.KeyPress
If e.KeyChar = Chr(13) Then 'focus on next control