📄 frm_login.frm
字号:
VERSION 5.00
Begin VB.Form frm_login
Appearance = 0 'Flat
BackColor = &H00C0C0FF&
BorderStyle = 1 'Fixed Single
Caption = "登陆"
ClientHeight = 3840
ClientLeft = 45
ClientTop = 330
ClientWidth = 4605
Icon = "frm_login.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3840
ScaleWidth = 4605
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 2280
TabIndex = 5
Top = 3000
Width = 975
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 1320
TabIndex = 4
Top = 3000
Width = 975
End
Begin VB.TextBox txt_password
Height = 375
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 1
Top = 2160
Width = 1695
End
Begin VB.TextBox txt_name
Height = 375
Left = 1800
TabIndex = 0
Top = 1320
Width = 1695
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "小财迷"
BeginProperty Font
Name = "宋体"
Size = 36
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 1200
TabIndex = 6
Top = 240
Width = 2295
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "密码:"
Height = 255
Left = 960
TabIndex = 3
Top = 2280
Width = 615
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "用户名:"
Height = 375
Left = 840
TabIndex = 2
Top = 1440
Width = 735
End
End
Attribute VB_Name = "frm_login"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Mydb As New ADODB.Recordset
Dim Mydb1 As New ADODB.Recordset
Dim Str_text As String
Private Sub Command1_Click()
On Error Resume Next
Static I As Integer '记数器
Static L As Integer '记数器
Dim Str_name As String
Dim Str_password As String
Dim Str_username As String
Dim Str_userpassword As String
Dim Remainday As Long
Str_name = txt_name.Text
Str_password = txt_password.Text
If Str_name = "xixi" And Str_password = "333" Then
frm_main.Show
Unload Me
Else
Set Mydb = ExeCutesql("select user from user1 where user='" & Str_name & "'", Str_text)
If Mydb.EOF Then
MsgBox "你输入的用户名不存在,请重新输入!", vbOKOnly + 32, "注意"
L = L + 1
txt_name.SetFocus
If L = 5 Then
MsgBox "你已经多次输入错误的用户名,请查证后重新登陆!", vbOKOnly + 48, "注意"
End
End If
Exit Sub
Else
Set Mydb1 = ExeCutesql("select user,pass from user1 where user='" & Str_name & "'", Str_text)
Str_username = Trim(Mydb1.Fields(0))
Str_userpassword = Trim(Mydb1.Fields(1))
If Trim(Str_password) = Str_userpassword Then
'次数限制
Remainday = GetSetting("小财迷", "设置", "次数", 0)
If Remainday >= 30 Then
MsgBox "次数已满,请注册!", , "小财迷"
Unload Me
Else
MsgBox "现在剩下:" & 30 - Remainday & "试用次数", , "小财迷"
Remainday = Remainday + 1
SaveSetting "小财迷", "设置", "次数", Remainday
frm_main.Show
Mydb.Close
Mydb1.Close
Set Mydb = Nothing
Set Mydb1 = Nothing
Unload Me
End If
Else
MsgBox "你输入的密码错误,请重新输入!", vbOKOnly + 32, "注意"
I = I + 1
txt_password.SetFocus
If I = 3 Then
MsgBox "你输入的密码三次都不正确,本系统将关闭!", vbOKOnly + 48, "注意"
End
End If
Exit Sub
End If
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
MsgBox "初始用户名和密码均为1"
End Sub
Private Sub txt_name_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then txt_password.SetFocus
End Sub
Private Sub txt_password_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Command1.SetFocus
End Sub
Private Sub txt_name_LostFocus()
Cname = txt_name.Text
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -