📄 frmlogin.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmlogin
BorderStyle = 0 'None
Caption = "login"
ClientHeight = 4320
ClientLeft = 0
ClientTop = 0
ClientWidth = 7500
LinkTopic = "Form1"
Picture = "frmlogin.frx":0000
ScaleHeight = 4320
ScaleWidth = 7500
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Adodc1
Height = 495
Left = 4320
Top = 240
Visible = 0 'False
Width = 1455
_ExtentX = 2566
_ExtentY = 873
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
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.TextBox Text2
Appearance = 0 'Flat
Height = 270
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 3
Top = 1800
Width = 1095
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 270
Left = 2280
TabIndex = 2
Top = 1200
Width = 1095
End
Begin VB.Line Line8
X1 = 2160
X2 = 2760
Y1 = 3360
Y2 = 3360
End
Begin VB.Line Line7
X1 = 2760
X2 = 2760
Y1 = 3000
Y2 = 3360
End
Begin VB.Line Line6
X1 = 2160
X2 = 2760
Y1 = 3000
Y2 = 3000
End
Begin VB.Line Line5
X1 = 2160
X2 = 2160
Y1 = 3000
Y2 = 3360
End
Begin VB.Line Line4
X1 = 1800
X2 = 2400
Y1 = 2760
Y2 = 2760
End
Begin VB.Line Line3
X1 = 2400
X2 = 2400
Y1 = 2400
Y2 = 2760
End
Begin VB.Line Line2
X1 = 1800
X2 = 2400
Y1 = 2400
Y2 = 2400
End
Begin VB.Line Line1
X1 = 1800
X2 = 1800
Y1 = 2400
Y2 = 2760
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "取消"
BeginProperty Font
Name = "华文行楷"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 285
Left = 2180
TabIndex = 5
Top = 3070
Width = 570
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "确定"
BeginProperty Font
Name = "华文行楷"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 285
Left = 1800
TabIndex = 4
ToolTipText = "单击确定,确认你的选择"
Top = 2445
Width = 570
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "密码"
BeginProperty Font
Name = "华文行楷"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 285
Left = 1080
TabIndex = 1
Top = 1800
Width = 570
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用户名"
BeginProperty Font
Name = "华文行楷"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 285
Left = 1320
TabIndex = 0
Top = 1200
Width = 855
End
End
Attribute VB_Name = "frmlogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
On Error Resume Next
Line1.Visible = False
Line2.Visible = False
Line3.Visible = False
Line4.Visible = False
Line5.Visible = False
Line6.Visible = False
Line7.Visible = False
Line8.Visible = False
Dim provider As String
Dim datasource As String
provider = "provider=Microsoft.jet.oledb.4.0"
datasource = "data source=" & App.Path & "\DB.mdb"
With Adodc1
.Mode = adModeReadWrite
.ConnectionString = provider & ";" & datasource
.CommandType = adCmdTable
.RecordSource = "yonghu"
.Refresh
.Recordset.MoveFirst
End With
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Line1.Visible = False
Line2.Visible = False
Line3.Visible = False
Line4.Visible = False
Line5.Visible = False
Line6.Visible = False
Line7.Visible = False
Line8.Visible = False
End Sub
Private Sub Label3_Click()
Static num As Integer
On Error Resume Next
If Text1.Text = "" Then
MsgBox "请输入用户名!", 48, "提示"
Exit Sub
End If
Adodc1.Recordset.MoveFirst
For I = 1 To Adodc1.Recordset.RecordCount
If Adodc1.Recordset.Fields("用户") = Text1.Text And Text2.Text = Trim(Adodc1.Recordset.Fields("pass")) Then
main.Text1.Text = Adodc1.Recordset.Fields("级别")
main.Text2.Text = Adodc1.Recordset.Fields("用户")
main.Show
Unload Me
Else
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then
num = num + 1
Text1.Text = ""
Text2.Text = ""
MsgBox "登陆不成功,请重新登陆!", 48, "提示"
Text1.SetFocus
End If
If num = 3 Then
num = 0
End
End If
End If
Next
End Sub
Private Sub Label3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Line1.BorderColor = &H808080
Line2.BorderColor = &H808080
Line3.BorderColor = &HE0E0E0
Line4.BorderColor = &HE0E0E0
End Sub
Private Sub Label3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Line1.BorderColor = &HE0E0E0
Line2.BorderColor = &HE0E0E0
Line3.BorderColor = &H808080
Line4.BorderColor = &H808080
Line1.Visible = True
Line2.Visible = True
Line3.Visible = True
Line4.Visible = True
End Sub
Private Sub Label4_Click()
Unload Me
End Sub
Private Sub Label4_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Line5.BorderColor = &H808080
Line6.BorderColor = &H808080
Line7.BorderColor = &HE0E0E0
Line8.BorderColor = &HE0E0E0
End Sub
Private Sub Label4_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Line5.BorderColor = &HE0E0E0
Line6.BorderColor = &HE0E0E0
Line7.BorderColor = &H808080
Line8.BorderColor = &H808080
Line5.Visible = True
Line6.Visible = True
Line7.Visible = True
Line8.Visible = True
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
Static num As Integer
If KeyAscii = 13 Then
On Error Resume Next
If Text1.Text = "" Then
MsgBox "请输入用户名!", 48, "提示"
Exit Sub
End If
Adodc1.Recordset.MoveFirst
For I = 1 To Adodc1.Recordset.RecordCount
If Adodc1.Recordset.Fields("用户") = Text1.Text And Text2.Text = Trim(Adodc1.Recordset.Fields("pass")) Then
main.Text1.Text = Adodc1.Recordset.Fields("级别")
main.Text2.Text = Adodc1.Recordset.Fields("用户")
main.Show
Unload Me
Else
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then
num = num + 1
Text1.Text = ""
Text2.Text = ""
MsgBox "登陆不成功,请重新登陆!", 48, "提示"
Text1.SetFocus
End If
If num = 3 Then
num = 0
End
End If
End If
Next
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -