📄 login.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form login
BorderStyle = 0 'None
Caption = "请您先登录:"
ClientHeight = 4020
ClientLeft = 0
ClientTop = 0
ClientWidth = 5385
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form2"
ScaleHeight = 4020
ScaleWidth = 5385
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
IMEMode = 3 'DISABLE
Left = 1920
PasswordChar = "*"
TabIndex = 4
Top = 1920
Width = 1575
End
Begin VB.ComboBox Combo1
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
ItemData = "login.frx":0000
Left = 1920
List = "login.frx":0002
TabIndex = 3
Text = "请选择"
Top = 1200
Width = 1575
End
Begin MSAdodcLib.Adodc Adodc1
Height = 495
Left = -1320
Top = 3960
Visible = 0 'False
Width = 1695
_ExtentX = 2990
_ExtentY = 873
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.CommandButton denglu
Caption = "登录"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 4680
TabIndex = 2
Top = 3600
Width = 615
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "密码"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 255
Left = 1080
TabIndex = 1
Top = 2040
Width = 735
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "用户名"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0080FFFF&
Height = 375
Left = 960
TabIndex = 0
Top = 1200
Width = 855
End
End
Attribute VB_Name = "login"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim b As Boolean
Dim cnt As Integer
Dim userid As Integer
Private Sub Combo1_Click()
userid = Combo1.ListIndex
Text1.SetFocus
End Sub
Private Sub denglu_Click()
Adodc1.Recordset.MoveFirst
For p = 1 To userid
Adodc1.Recordset.MoveNext
Next
If Text1.Text <> Adodc1.Recordset("密码") Then
MsgBox "您输入的密码不正确,请重新登录", vbCritical, "错误提示"
Else
cnt = Adodc1.Recordset("访问次数") + 1
k = MsgBox("祝贺你成功登录 " + Chr(13) + "这是您第" & cnt & "次访问该系统", vbOKOnly, "Congratulations")
Adodc1.Recordset("访问次数") = cnt
Adodc1.Recordset.update
End If
If k = 1 Then
enter.Visible = True
Unload Me
Load enter
End If
End Sub
Private Sub Form_Load()
login.Picture = LoadPicture(App.Path & "\login2.jpg")
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\datadb.mdb"
Adodc1.RecordSource = "登录"
Adodc1.Refresh
Adodc1.Recordset.MoveFirst
Do While Not Adodc1.Recordset.EOF
Combo1.AddItem Adodc1.Recordset("用户名")
Adodc1.Recordset.MoveNext
Loop
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
denglu.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -