Reputation: 9
I need to convert this language (written in VB6) to VB.NET:
Private Sub txt1_KeyPress(KeyAscii as Integer)
If KeyAscii=13 Then
XXX=CStr(txt1.Text)
txt2.SetFocus
End If
End Sub
I just wanted that by pressing the Enter key (KeyAscii=13) the txt1 sets the Focus to the next text box txt2
.
Can someone help me? Thanks.
Upvotes: 0
Views: 2059
Reputation: 1780
Try this:
Private Sub Txt1_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles Txt1.KeyPress
If e.KeyChar.ToString = ChrW(Keys.Enter) Then
Txt2.Focus()
e.Handled = True
End If
End Sub
Upvotes: 1