Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
Dim KeyAscii As Short = Asc(e.KeyChar)
If KeyAscii = 13 Then
TextBox2.Focus()
End If
End Sub
Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
Dim KeyAscii As Short = Asc(e.KeyChar)
If KeyAscii = 13 Then
TextBox3.Focus()
End If
End Sub
Private Sub TextBox3_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox3.KeyPress
Dim KeyAscii As Short = Asc(e.KeyChar)
If KeyAscii = 13 Then
Button1.Focus()
End If
End Sub
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
Dim KeyAscii As Short = Asc(e.KeyChar)
If KeyAscii = 13 Then
TextBox2.Focus()
btn()
End If
End Sub
Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
Dim KeyAscii As Short = Asc(e.KeyChar)
If KeyAscii = 13 Then
Button1.Focus()
btn()
End If
End Sub
Sub btn()
If TextBox1.Text <> "" And TextBox2.Text <> "" Then
MsgBox("ทำงาน")
End If
End Sub
Private Sub username_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles username.KeyPress
Dim KeyAscii As Short = Asc(e.KeyChar)
If KeyAscii = 13 Then
If username.Text = "" Then
MessageBox.Show("กรุณาใส่ User Name ด้วยครับ", "No UserID", MessageBoxButtons.OK, MessageBoxIcon.Error)
username.Focus()
Else
password_txt.Focus()
End If
End If
End Sub
Private Sub password_txt_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles password_txt.KeyPress
Dim KeyAscii As Short = Asc(e.KeyChar)
If KeyAscii = 13 Then
If username.Text = "" Then
MessageBox.Show("กรุณาใส่ PassWord ด้วยครับ", "No Password", MessageBoxButtons.OK, MessageBoxIcon.Error)
username.Focus()
Else
bt_ok.PerformClick()
End If
End If
End Sub