📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form 登陆
Caption = " 网上试题库管理系统"
ClientHeight = 7515
ClientLeft = 60
ClientTop = 450
ClientWidth = 8505
LinkTopic = "Form1"
Picture = "Form1.frx":0000
ScaleHeight = 7515
ScaleWidth = 8505
StartUpPosition = 3 '窗口缺省
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access 2000;"
DatabaseName = ""
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = 600
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 7080
Visible = 0 'False
Width = 1140
End
Begin VB.CommandButton Command4
Caption = "取消"
Height = 495
Left = 6480
TabIndex = 17
Top = 4320
Width = 1215
End
Begin VB.CommandButton Command3
Caption = "找回密码"
Height = 495
Left = 6480
TabIndex = 16
Top = 3360
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "注册"
Height = 495
Left = 6480
TabIndex = 15
Top = 2400
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "登陆"
Height = 495
Left = 6480
TabIndex = 14
Top = 1440
Width = 1215
End
Begin VB.OptionButton Option2
Height = 495
Left = 4560
TabIndex = 13
Top = 3600
Width = 255
End
Begin VB.OptionButton Option1
Height = 495
Left = 4560
Picture = "Form1.frx":1DDAE
TabIndex = 12
Top = 240
Width = 375
End
Begin VB.Frame Frame2
BackColor = &H80000005&
Caption = "用户登陆"
ForeColor = &H80000011&
Height = 2295
Left = 720
TabIndex = 3
Top = 4320
Width = 5175
Begin VB.TextBox Text6
Height = 495
Left = 1560
TabIndex = 23
Top = 1440
Width = 1335
End
Begin VB.TextBox Text5
Height = 495
Left = 1560
TabIndex = 22
Top = 840
Width = 1335
End
Begin VB.TextBox Text4
Height = 495
Left = 1560
TabIndex = 21
Top = 240
Width = 1335
End
Begin VB.Label Label10
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "验证码"
Height = 180
Left = 3720
TabIndex = 11
Top = 1560
Width = 540
End
Begin VB.Label Label9
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "验证码"
Height = 180
Left = 480
TabIndex = 10
Top = 1560
Width = 540
End
Begin VB.Label Label8
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "密码"
Height = 180
Left = 480
TabIndex = 9
Top = 960
Width = 360
End
Begin VB.Label Label7
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "帐号"
Height = 180
Left = 480
TabIndex = 8
Top = 360
Width = 360
End
End
Begin VB.Frame Frame1
BackColor = &H80000005&
Caption = "操作员登陆"
ForeColor = &H80000010&
Height = 2295
Left = 720
TabIndex = 2
Top = 1080
Width = 5175
Begin VB.TextBox Text3
Height = 495
Left = 1560
TabIndex = 20
Top = 1560
Width = 1215
End
Begin VB.TextBox Text2
Height = 495
Left = 1560
TabIndex = 19
Top = 960
Width = 1215
End
Begin VB.TextBox Text1
Height = 495
Left = 1560
TabIndex = 18
Top = 360
Width = 1215
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "验证码"
Height = 180
Left = 3720
TabIndex = 7
Top = 1680
Width = 540
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "验证码"
Height = 180
Left = 360
TabIndex = 6
Top = 1680
Width = 540
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "密码"
Height = 180
Left = 480
TabIndex = 5
Top = 1080
Width = 360
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "帐号"
Height = 180
Left = 480
TabIndex = 4
Top = 480
Width = 360
End
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用户登陆"
BeginProperty Font
Name = "宋体"
Size = 24
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 495
Left = 2280
TabIndex = 1
Top = 3600
Width = 1980
End
Begin VB.Label label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "操作员登陆"
BeginProperty Font
Name = "宋体"
Size = 24
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 495
Left = 1920
TabIndex = 0
Top = 240
Width = 2475
End
End
Attribute VB_Name = "登陆"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Option1.Value = True Then
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Then
inta = MsgBox("请输入正确的信息", , "温馨提示")
Else
Data1.Recordset.MoveFirst '记录集的move方法
Data1.Recordset.FindFirst ("操作员='" & Text1.Text & "'") '寻找第一个满足条件的记录
If Data1.Recordset.NoMatch Then
inta = MsgBox("无此用户,请查证后再填", , "温馨提示")
Else
If Text2.Text <> Data1.Recordset.Fields("密码") Then
inta = MsgBox("密码错误", , "温馨提示")
Text2.SetFocus
Else
If Text3.Text = Label6.Caption Then
主界面.Show
主界面.shanchu.Enabled = True
主界面.guanli.Enabled = True
主界面.suoyou.Enabled = True
登陆.Hide
End If
End If
End If
End If
Else
If Option2.Value = True Then '判断数据表源
If Text4.Text = "" Then
inta = MsgBox("请输入正确的信息", , "温馨提示")
Else
Data1.Recordset.FindFirst ("帐号='" & Text4.Text & "'")
If Data1.Recordset.NoMatch Then
inta = MsgBox("无此用户,请查证后再填", , "温馨提示")
Text4.SetFocus
Else
If Text5.Text <> Data1.Recordset.Fields("密码") Then
inta = MsgBox("密码错误", , "温馨提示")
Text5.SetFocus
Else
If Text6.Text = Label10.Caption Then
主界面.Show
主界面.shanchu.Enabled = False '操作权限限制
主界面.guanli.Enabled = False '操作权限限制
主界面.suoyou.Enabled = False '操作权限限制
登陆.Hide
End If
End If
End If
End If
Else
inta = MsgBox("请选择登陆者类型", , "温馨提示")
End If
End If
End Sub
Private Sub Command2_Click()
用户注册.Show
登陆.Hide
End Sub
Private Sub Command3_Click()
密码找回.Show
登陆.Hide
密码找回.Text1.Text = ""
密码找回.Text2.Text = ""
密码找回.Combo1.Text = "请选择"
密码找回.Label4.Caption = "密码返回框"
密码找回.Label5.Caption = ""
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Form_Load()
Show
Data1.DatabaseName = "试题库.mdb" '控件连接数据库
Option1.Value = False
Text2.PasswordChar = "*"
Text5.PasswordChar = "*"
End Sub
Private Sub Option1_Click()
Data1.RecordSource = "操作员" '不同的操作,联不同的源
Data1.Refresh
End Sub
Private Sub Option2_Click()
Data1.RecordSource = "用户" '不同的操作,联不同的源
Data1.Refresh
End Sub
Private Sub Text1_GotFocus()
Label6.Caption = Int(Rnd * 9000 + 1000) '随机函数Rnd,产生随机数
End Sub
Private Sub Text1_LostFocus()
Text2.SetFocus
End Sub
Private Sub text4_gotfocus()
Label10.Caption = Int(Rnd * 9000 + 1000) '随机函数Rnd,产生随机数
End Sub
Private Sub Text4_LostFocus()
Text5.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -