ASCII码 下面判断的是非0——9的数 ASCII码表可查c程序的附录
Private Sub Text9_KeyPress(KeyAscii As Integer)
If KeyAscii < 48 Or KeyAscii > 57 Then
KeyAscii = 0
Exit Sub
End If
End Sub
Dim regEx As New RegExp
Dim Matches As MatchCollection
Dim str as string
str="abcdefghi.jk-"
regEx.Pattern = "[^a-zA-Z0-9\.\- ]"
Set Matches = regEx.Execute(str)
If Matches.Count > 0 Then
msgbox "error!"
End If
Function StrInStrL(Str As String) As Boolean
Dim Str0 As String
Dim i As Integer
Str0 = "1234567890ABCDEFGHIJKLMNOPQRESUVWXYZ._"
i = InStr(1, Str, Str0)
If i >= 0 Then
MsgBox "包含在指定字符串中。"
Else
MsgBox "不包含在指定字符串中。"
End If
End Function