📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form form1
BackColor = &H00808080&
Caption = "系统登录"
ClientHeight = 2265
ClientLeft = 60
ClientTop = 345
ClientWidth = 5490
Icon = "form1.frx":0000
LinkTopic = "Form1"
Picture = "form1.frx":030A
ScaleHeight = 2265
ScaleWidth = 5490
StartUpPosition = 2 '屏幕中心
Begin VB.ComboBox master
Height = 300
Left = 2250
TabIndex = 5
Top = 360
Width = 1935
End
Begin VB.CommandButton Cmdexit
BackColor = &H00C0C0C0&
Caption = "退出"
Height = 400
Left = 3045
Style = 1 'Graphical
TabIndex = 2
Top = 1530
Width = 1365
End
Begin VB.CommandButton Cmdok
BackColor = &H00C0C0C0&
Caption = "确定"
Height = 400
Left = 1665
MaskColor = &H00FF8080&
Style = 1 'Graphical
TabIndex = 0
Top = 1530
UseMaskColor = -1 'True
Width = 1365
End
Begin VB.TextBox password
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
IMEMode = 3 'DISABLE
Left = 2250
MaxLength = 6
PasswordChar = "*"
TabIndex = 1
Top = 795
Width = 1905
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "密 码: "
BeginProperty Font
Name = "黑体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 1335
TabIndex = 4
Top = 810
Width = 855
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "操作员: "
BeginProperty Font
Name = "黑体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 1335
TabIndex = 3
Top = 330
Width = 1095
End
End
Attribute VB_Name = "form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim TIM As Integer
Dim mydb As Database
Dim myrs As Recordset
Dim sql As String
Private Sub Form_Activate()
Set mydb = Workspaces(0).OpenDatabase(App.Path & "\kfgl.mdb") '打开数据库
sql = "select 操作员 from qxsz"
Set myrs = mydb.OpenRecordset(sql)
If myrs.EOF = False Then myrs.MoveLast
If myrs.BOF = False Then myrs.MoveFirst
For i = 0 To myrs.RecordCount - 1
master.AddItem (myrs.Fields(0))
myrs.MoveNext
Next i
If master.ListCount > 0 Then master.ListIndex = 0
myrs.Close
mydb.Close
master.SetFocus
End Sub
Private Sub Cmdok_Click() '确认操作员和密码
Dim MESSAGE As String
If master.Text <> "" Then
Set mydb = Workspaces(0).OpenDatabase(App.Path & "\kfgl.mdb")
Set myrs = mydb.OpenRecordset("qxsz", dbOpenDynaset)
myrs.FindFirst "操作员 = " + Chr(34) + master.Text + Chr(34) + "" ' 查找操作员
If myrs.NoMatch Then '没查到记录
MsgBox ("无此操作员!")
Else
If password.Text = myrs.Fields("密码") Then '确认密码
MsgBox "系统登陆成功!" '系统登录成功
Else
If TIM = 3 Then
MESSAGE = MsgBox("密码输入错误,请向系统管理员查询!", 0, "")
If MESSAGE = vbOK Then End
End If
MsgBox ("密码错误,请重新输入密码!")
TIM = TIM + 1 '密码输入错误次数
password.SetFocus
End If
End If
End If
End Sub
Private Sub master_KeyDown(KeyCode As Integer, Shift As Integer) '回车换行
If KeyCode = vbKeyReturn Then
password.SetFocus
End If
End Sub
Private Sub password_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
Cmdok.Visible = True
Cmdok.SetFocus
End If
If KeyCode = vbKeyDown Then
Cmdok.Visible = True
Cmdok.SetFocus
End If
If KeyCode = vbKeyUp Then
master.SetFocus
End If
End Sub
Private Sub Cmdexit_Click()
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -