📄 modverifyinput.bas
字号:
Attribute VB_Name = "modVerifyInput"
'========================================================
'|| 客户端输入验证模块 ||
'========================================================
'=======================================
' 输入验证用,判断长度是否非法
' 呢称、密码、爱好不能为 0 长度
'=======================================
Public Function TxtLenError(ByVal txtCtl As TextBox, _
ByVal intMaxLen As Integer, _
ByVal strDisp) As Boolean
If Len(Trim(txtCtl.Text)) > intMaxLen Or Len(Trim(txtCtl.Text)) = 0 Then
MsgBox strDisp + " 不允许为空,最多" + CStr(intMaxLen) + "个字符!", 16, "ICQ客户"
txtCtl.Text = ""
txtCtl.SetFocus
TxtLenError = True
Else
TxtLenError = False
End If
End Function
'===============================================================
' 校验输入的各文本中是否含有所有命令分隔符、数据库记录集字符串分隔符
' 如果含有返回 True
'===============================================================
Public Function VerifyComdDiv(ByVal txtCtl As TextBox, _
ByVal strDisp As String) As Boolean
If InStrComdDiv(txtCtl, strFdRd, strDisp) Or _
InStrComdDiv(txtCtl, strFdDivRst, strDisp) Or _
InStrComdDiv(txtCtl, strCommandDiv, strDisp) Or _
InStrComdDiv(txtCtl, CmdResultDiv, strDisp) Then
VerifyComdDiv = True
Else
VerifyComdDiv = False
End If
End Function
'===============================================================
' 校验输入的各文本中是否含有指定命令分隔符、数据库记录集字符串分隔符
' 如果含有则显示出错信息,并返回True。
'===============================================================
Public Function InStrComdDiv(ByVal txtCtl As TextBox, _
ByVal strComdDiv As String, _
ByVal strDisp As String) As Boolean
If InStr(1, txtCtl.Text, strComdDiv, vbTextCompare) <> 0 Then
MsgBox strDisp + "中不允许有" + strComdDiv + "字符!", 16, "ICQ客户"
txtCtl.Text = ""
txtCtl.SetFocus
InStrComdDiv = True
Else
InStrComdDiv = False
End If
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -