📄 modmain.bas
字号:
Attribute VB_Name = "ModMain"
'定义程序入口为frmlogin窗体
'定义符合登录条件的函数
Public Function Login(ByVal strUser As String, ByVal strPwd As String) As Boolean
If strUser = "Admin" And strPwd = "123" Then
Login = True
Else
Login = False
End If
End Function
'定义输入数字时过滤条件的函数
Public Function IsNumber(ByVal str As String) As Boolean
Dim i As Integer
Dim intindex As Integer
intindex = 0
Dim length As Integer
length = Len(str)
IsNumber = True
For i = 1 To length
If Left(str, 1) >= "0" And Left(str, 1) <= "9" Or Left(str, 1) = "." Then
If Left(str, 1) = "." Then
intindex = intindex + 1
End If
Else
IsNumber = False
Exit Function
End If
str = Right(str, Len(str) - 1) '此处的str动态变化!!
Next i
If intindex > 1 Then
IsNumber = False
Exit Function
End If
End Function
'定义输入字符时过滤条件的函数
Public Function IsChar(ByVal str As String) As Boolean
Dim i As Integer
Dim length As Integer
lengh = Len(str)
IsChar = True
For i = 1 To lengh
If Left(str, 1) <> "'" And Left(str, 1) <> "[" And Left(str, 1) <> "]" _
And Left(str, 1) <> "%" And Left(str, 1) <> "_" And Left(str, 1) <> " " Then
Else
IsChar = False
End If
str = Right(str, Len(str) - 1)
Next i
End Function
Public Function IsEmpty(ByVal rs As ADODB.Recordset) As Boolean
If rs.EOF = True Then
MsgBox "数据表中无记录!", vbInformation + vbOKOnly, "无法查询!"
IsEmpty = False
Else
IsEmpty = True
End If
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -