📄 cuser.vb
字号:
Public Class cUser
'定义属性过程
Private theName As String
Public Property Name() As String
Get
Return theName
End Get
Set(ByVal Value As String)
'If Value.Length = 0 Then
' MessageBox.Show("用户名不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
'Else
' theName = Trim(LCase(Value)) '为了防止误输入空格,且将输入的字母转换为小写。
'End If
theName = Trim(LCase(Value))
End Set
End Property
Private thePwd As String
Public Property Password() As String
Get
Return thePwd
End Get
Set(ByVal Value As String)
thePwd = Trim(LCase(Value))
End Set
End Property
Private theType As String
Public Property Type() As String
Get
Return theType
End Get
Set(ByVal Value As String)
theType = Value
End Set
End Property
Public Function CheckUser(ByVal username As String, ByVal userpwd As String, ByVal usertype As String) As Char
If username = "zs" Then
If userpwd = "123" Then
If usertype = "学生" Then
MessageBox.Show("恭喜,登录成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Return "1"
Else
MessageBox.Show("用户类型不符", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
Else
MessageBox.Show("密码不正确", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Function
End If
ElseIf username = "ls" Then
If userpwd = "456" Then
If usertype = "教师" Then
MessageBox.Show("恭喜,登录成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Return "2"
Else
MessageBox.Show("用户类型不符", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
Else
MessageBox.Show("密码不正确", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Function
End If
Else
MessageBox.Show("该用户名不存在", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End Function
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -