Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
Dim keyii As Integer
keyii = Asc(e.KeyChar)
Select Case keyii
Case 48 To 57, 65 To 90, 97 To 122
Case Else
keyii = 0
End Select
If keyii = 0 Then
e.Handled = True
Else
e.Handled = False
End If
End Sub