📄 cad.frm
字号:
VERSION 5.00
Begin VB.Form cad
BorderStyle = 1 'Fixed Single
Caption = "管理员身份验证"
ClientHeight = 2040
ClientLeft = 45
ClientTop = 330
ClientWidth = 3930
Icon = "cad.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2040
ScaleWidth = 3930
StartUpPosition = 2 '屏幕中心
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "F:\vb程序1\vb程序1\V_Library.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 285
Left = 720
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "管理员名单"
Top = 120
Visible = 0 'False
Width = 2535
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 2378
TabIndex = 5
Top = 1560
Width = 855
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 698
TabIndex = 4
Top = 1560
Width = 855
End
Begin VB.TextBox Text1
Height = 270
IMEMode = 3 'DISABLE
Left = 1838
PasswordChar = "*"
TabIndex = 3
Top = 1065
Width = 1215
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1838
TabIndex = 2
Top = 480
Width = 1215
End
Begin VB.Label Label2
Caption = "密 码"
Height = 255
Left = 878
TabIndex = 1
Top = 1080
Width = 735
End
Begin VB.Label Label1
Caption = "用户名"
Height = 255
Left = 878
TabIndex = 0
Top = 525
Width = 735
End
End
Attribute VB_Name = "cad"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo1_Change()
Dim getitem As String
Dim dresult As Integer
Dim deng As Integer
For deng = 0 To Combo1.ListCount - 1
getitem = Left(Combo1.List(deng), Len(Combo1.Text))
dresult = StrComp(Combo1.Text, getitem, 1)
If dresult = 0 Then Combo1.ListIndex = deng: Exit Sub
Next deng
End Sub
Private Sub Combo1_Click()
Text1.SetFocus
End Sub
Private Sub Command1_Click()
Dim mystr As String
Dim response As String
Dim response1 As String
Data1.Recordset.MoveFirst
If Combo1.Text = "" Or Text1.Text = "" Then
response1 = MsgBox("请将用户名和密码填写完整!", vbExclamation, "警告")
Combo1.SetFocus
Exit Sub
End If
mystr = "用户名" & "=" & "'" & Combo1.Text & "'"
Data1.Recordset.FindFirst mystr
If Trim(Data1.Recordset.Fields("密码")) = Trim(Text1.Text) Then
Unload Me
Load safrm
adfrm.Show
Else
response = MsgBox("密码错误!", vbExclamation, "警告")
Text1.Text = ""
End If
End Sub
Private Sub Command2_Click()
Unload Me
Load choose
choose.Show
End Sub
Private Sub Form_Activate()
Data1.Recordset.MoveFirst
Do While Not Data1.Recordset.EOF
If Data1.Recordset.Fields("权限").Value = "管理员" Then
Combo1.AddItem (Data1.Recordset.Fields("用户名").Value)
End If
Data1.Recordset.MoveNext
Loop
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = Asc(vbCr) Then
KeyAscii = 0
Call Command1_Click
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -