📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
BorderStyle = 3 'Fixed Dialog
Caption = "登录-高校科研管理系统"
ClientHeight = 4305
ClientLeft = 2835
ClientTop = 3480
ClientWidth = 5775
Icon = "frmLogin.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Picture = "frmLogin.frx":044A
ScaleHeight = 4305
ScaleWidth = 5775
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox txtUserName
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 345
Left = 2760
TabIndex = 1
Top = 2040
Width = 2325
End
Begin VB.TextBox txtPassword
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 345
IMEMode = 3 'DISABLE
Left = 2760
PasswordChar = "*"
TabIndex = 3
Top = 2640
Width = 2325
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "退出系统"
BeginProperty Font
Name = "华文行楷"
Size = 24
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 495
Left = 3360
MouseIcon = "frmLogin.frx":56E5
MousePointer = 99 'Custom
TabIndex = 6
Top = 3360
Width = 1920
End
Begin VB.Label cmdOK
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "登录系统"
BeginProperty Font
Name = "华文行楷"
Size = 24
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 495
Left = 840
MouseIcon = "frmLogin.frx":5FAF
MousePointer = 99 'Custom
TabIndex = 5
Top = 3360
Width = 1920
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "高校科研管理系统"
BeginProperty Font
Name = "华文新魏"
Size = 26.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 525
Left = 1200
TabIndex = 4
Top = 120
Width = 4320
End
Begin VB.Image Image1
Height = 1770
Left = 0
Picture = "frmLogin.frx":63F1
Top = 0
Width = 5805
End
Begin VB.Label lblLabels
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用户名称:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Index = 0
Left = 1320
TabIndex = 0
Top = 2160
Width = 1275
End
Begin VB.Label lblLabels
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "密 码:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Index = 1
Left = 1440
TabIndex = 2
Top = 2760
Width = 1170
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public miCount As Integer
Private Sub cmdCancel_Click()
End
End Sub
Private Sub cmdOK_Click()
On Error GoTo Err
Dim txtsql As String
UserName = ""
If Trim(txtUserName.Text = "") Then
MsgBox "请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else '''
Dim sysPassword As String
sysPassword = GetSetting(App.Title, "Settings", "syspassword", "admin")
If Trim(txtUserName.Text) = "admin" And Trim(txtPassword.Text) = sysPassword Then '''管理员进入
UserName = txtUserName.Text
'初始化系统
Ok = True
Unload Me
Mainfrm.Show
ElseIf Trim(txtUserName.Text) <> "admin" Then
txtsql = "select * from user_Info where 姓名 = '" & txtUserName.Text & "'"
If rs.State Then rs.Close
rs.Open txtsql, CN, adOpenStatic, adLockOptimistic
If rs.EOF = True Then
MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else
If Trim(rs.Fields(1)) = Trim(txtPassword.Text) Then
UserName = Trim(txtUserName.Text)
SaveSetting App.Title, "Settings", "user_name", UserName
Ok = True
Unload Me
Mainfrm.Show
Else
MsgBox "密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
txtPassword.SetFocus
txtPassword.Text = ""
End If
End If
Else
MsgBox "密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
End If
End If
miCount = miCount + 1
Ok = False
If miCount = 3 Then
End
End If
Exit Sub
Err:
MsgBox "密码不正确,请与管理员联系!", vbExclamation
Ok = False
End
End Sub
Private Sub Form_Activate()
txtPassword.SetFocus
End Sub
Private Sub Form_Load()
If CN.State Then CN.Close
CN.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\database.mdb;Persist Security Info=False"
CN.Open
miCount = 0
Ok = False
txtUserName.Text = GetSetting(App.Title, "Settings", "user_name", "")
End Sub
Private Sub Label2_Click()
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -