VB的一些项目中常用的通用方法-一般用于验证类

1.VB的一些项目中常用的通用方法:

'  设置校验键盘输入值,数字
Public Function kyd(key As Integer) As Integer
'
Dim mychar
mychar = "0123456789-" & Chr() & Chr() If InStr(mychar, Chr(key)) = Then
kyd =
' MsgBox "只能输入数字"
Exit Function
Else
kyd = key
End If End Function ' 设置校验键盘输入值,数字
Public Function knum(key As Integer) As Integer
'
Dim mychar
mychar = "0123456789." & Chr() & Chr() If InStr(mychar, Chr(key)) = Then
knum = ' MsgBox "只能输入数字" Exit Function
Else
knum = key
End If End Function ' 设置校验键盘输入值,数字
Public Function krq(key As Integer) As Integer
'
Dim mychar
mychar = "" & Chr() & Chr() If InStr(mychar, Chr(key)) = Then
krq = ' MsgBox "只能输入数字" Exit Function
Else
krq = key
End If End Function ' 设置校验键盘输入值,数字和字母可以
Public Function knumCHAR(key As Integer) As Integer
'
Dim mychar
mychar = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" & Chr() & Chr() If InStr(mychar, Chr(key)) = Then
key = ' MsgBox "只能输入数字" Exit Function
Else
' key = key
End If End Function
上一篇:KVM virsh常用命令篇


下一篇:(42)嵌入式项目中常用到的C语言技能总结