Private Sub txt_empusername_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txt_empusername.KeyPress
If Not (Asc(e.KeyChar) = 8) Or (Asc(e.KeyChar) = 13) Or (Asc(e.KeyChar) = 46) Then
Dim allowedChars As String = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
If Not allowedChars.Contains(e.KeyChar.ToString.ToLower) Then
e.KeyChar = ChrW(0)
e.Handled = True
MessageBox.Show("กรุณากรอกเป็นภาษาอังกฤษหรือตัวเลขเท่านั้น")
End If
End If
End Sub