'Put under event "KeyPress"
Dim AllowedChars As String
AllowedChars = "0123456789_-qwertyuioplkjhgfdsazxcvbnm"
' If the character they have entered isn't in our list...
If InStr(AllowedChars, e.KeyChar.ToString) = 0 Then
'Cancel the character
e.Handled = True
End If