📄 formlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
BorderStyle = 3 'Fixed Dialog
Caption = "登录"
ClientHeight = 3075
ClientLeft = 45
ClientTop = 435
ClientWidth = 5415
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3075
ScaleWidth = 5415
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.TextBox txtUserID
Height = 375
Left = 1560
MaxLength = 10
TabIndex = 6
Text = "Text1"
Top = 960
Width = 1935
End
Begin VB.Data dataUser
Caption = "用户"
Connect = "Access 2000;"
DatabaseName = "C:\Program Files\StudentMIS\StudentMIS.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 375
Left = 3840
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "SELECT * FROM Users WHERE UserName ="" & txtUserName.Text & """
Top = 2160
Visible = 0 'False
Width = 1140
End
Begin VB.CommandButton cmdQuit
Caption = "退出"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2880
TabIndex = 5
Top = 2160
Width = 735
End
Begin VB.CommandButton cmdOK
Caption = "登录"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1440
TabIndex = 4
Top = 2160
Width = 735
End
Begin VB.TextBox txtPassword
Height = 375
IMEMode = 3 'DISABLE
Left = 1560
MaxLength = 10
PasswordChar = "*"
TabIndex = 3
Text = "Text1"
Top = 1560
Width = 1935
End
Begin VB.TextBox txtUserName
DataField = "UserName"
DataSource = "dataUser"
Height = 375
Left = 4080
MaxLength = 10
TabIndex = 2
Text = "Text1"
Top = 1560
Visible = 0 'False
Width = 735
End
Begin VB.Label Label5
Caption = "Hongs Yam ddDD Chen Pilihuo Wumg Charsman"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 255
Left = 600
TabIndex = 9
Top = 2640
Width = 4455
End
Begin VB.Label Label4
Caption = "2007试用版"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 3960
TabIndex = 8
Top = 960
Width = 1095
End
Begin VB.Label Label1
Caption = "学籍管理系统"
BeginProperty Font
Name = "宋体"
Size = 26.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1080
TabIndex = 7
Top = 240
Width = 3375
End
Begin VB.Label Label3
Caption = "密码"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 840
TabIndex = 1
Top = 1560
Width = 495
End
Begin VB.Label Label2
Caption = "用户名"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 600
TabIndex = 0
Top = 960
Width = 735
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Public LoginSucceded As Boolean
Dim BookMK
Private Sub cmdOK_Click()
Static Count As Byte
txtUserID.Text = Replace(Trim(txtUserID.Text), "'", "")
txtPassword.Text = Replace(Trim(txtPassword.Text), "'", "")
If txtUserID.Text = "" Then
MsgBox "用户名不能为空!"
txtUserName.SetFocus
Exit Sub
ElseIf txtPassword.Text = "" Then
MsgBox "密码不能为空!"
txtPassword.SetFocus
Exit Sub
ElseIf txtUserName.Text = "" Then
Count = Count + 1
If Count >= 3 Then
MsgBox " 你无权使用该系统!"
End
End If
If dataUser.Recordset.RecordCount > 0 Then
BookMK = dataUser.Recordset.Bookmark
Else
BookMK = Null
End If
txtUserID.Text = ""
txtPassword.Text = ""
txtUserID.SetFocus
MsgBox "用户名不存在!"
txtUserID.SetFocus
Exit Sub
End If
Me.Hide
frmMain.Show
'Set Conn = New ADODB.Connection
'Set rs = New ADODB.Recordset
'strSQL = " SELECT * FROM Users WHERE UserID = '" & strUserID & "'"
'strSQL = strSQL & " AND Password = '" & strPassword & "'"
'Conn.Open ConnString
'rs.Open strSQL, Conn
'If rs.EOF Then
' UserName = rs("UserName").Value
' Me.Hide
'rs.Close
'Conn.Close
'Set rs = Nothing
End Sub
Private Sub cmdQuit_Click()
End
End Sub
Private Sub Form_Load()
txtUserID.Text = ""
txtPassword.Text = ""
dataUser.DatabaseName = App.Path & "\StudentMIS.mdb"
dataUser.Visible = False
'If dataUser.Recordset.RecordCount > 0 Then
' BookMK = dataUser.Recordset.Bookmark
'Else
' BookMK = Null
'End If
'dataUser.Recordset.AddNew
End Sub
Private Sub txtUserID_Change()
strSQL = "SELECT * FROM Users WHERE UserID ='" & txtUserID.Text & "'"
dataUser.RecordSource = strSQL
dataUser.Refresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -