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