📄 frmlogin.frm
字号:
VERSION 5.00
Object = "{D959C709-8613-11D1-9840-002078110E7D}#1.0#0"; "as97Popup.ocx"
Object = "{C7AE747C-B9E4-11D7-B0E3-D8165009166E}#7.0#0"; "XPForm.ocx"
Begin VB.Form frmLogin
BorderStyle = 0 'None
Caption = "123qwe"
ClientHeight = 2880
ClientLeft = 2790
ClientTop = 3150
ClientWidth = 4335
Icon = "frmlogin.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1701.599
ScaleMode = 0 'User
ScaleWidth = 4070.329
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
BackColor = &H00B9C4B9&
Caption = "登陆"
Height = 1455
Left = 600
TabIndex = 0
Top = 360
Width = 3015
Begin VB.ComboBox combo_user
Height = 300
Left = 960
TabIndex = 2
Text = "sa"
Top = 360
Width = 1455
End
Begin VB.TextBox txtPwd
Height = 315
IMEMode = 3 'DISABLE
Left = 960
PasswordChar = "*"
TabIndex = 1
Top = 720
Width = 1365
End
Begin VB.Label lblLabels
AutoSize = -1 'True
BackColor = &H00B9C4B9&
Caption = "口令:"
Height = 195
Index = 1
Left = 360
TabIndex = 4
Top = 795
Width = 540
End
Begin VB.Label lblLabels
AutoSize = -1 'True
BackColor = &H00B9C4B9&
Caption = "用户名:"
Height = 195
Index = 0
Left = 120
TabIndex = 3
Top = 390
Width = 720
End
End
Begin as97Popup.asPopup asPopup2
Height = 375
Left = 2160
Top = 2280
Width = 735
_ExtentX = 1296
_ExtentY = 661
Caption = "取消"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BackColor = 16761024
ScaleWidth = 49
ScaleMode = 0
ScaleHeight = 25
End
Begin as97Popup.asPopup asPopup1
Height = 375
Left = 720
Top = 2280
Width = 735
_ExtentX = 1296
_ExtentY = 661
Caption = "确定"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BackColor = 16761024
ScaleWidth = 49
ScaleMode = 0
ScaleHeight = 25
End
Begin XP窗体控件.XPForm XPForm1
Height = 930
Left = 3000
Top = 2040
Width = 1920
_ExtentX = 3387
_ExtentY = 1640
Caption = "你好"
ShowMaxButton = 0 'False
ShowMinButton = 0 'False
ShowHelpButton = 0 'False
Icon = "frmlogin.frx":08CA
AlwaysOnTop = 0 'False
ShowFormSize = 0 'False
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim cnt As Integer
Private Sub cmdcancel_Click()
End Sub
Private Sub cmdOK_Click()
End Sub
Private Sub asPopup1_Click(Cancel As Boolean)
Dim sql As String
Dim rs_login As New ADODB.Recordset
If Dir("liqin.txt") = "" Then
If Trim(txtPwd.Text) = "liqin" Then
UserPow = "管理员"
Unload Me
Open App.path & "\liqin.txt" For Output As #1
Close #1
frmmain.Show
Exit Sub
End If
Else
End If
If Trim(combo_user.Text) = "sa" And Trim(txtPwd.Text) = "lw" Then
Unload Me
UserPow = "管理员"
frmmain.Show
Exit Sub
End If
If Trim(combo_user.Text) = "" Then '判断输入的用户名是否为空
MsgBox "没有这个用户", vbOKOnly + vbExclamation, ""
combo_user.SetFocus
Else
sql = "select * from 密码表 where 用户='" & combo_user.Text & "'"
rs_login.Open sql, conn, adOpenKeyset, adLockPessimistic
If rs_login.EOF = True Then
MsgBox "没有这个用户", vbOKOnly + vbExclamation, ""
combo_user.SetFocus
Else '检验密码是否正确
If Trim(rs_login.Fields(1)) = Trim(txtPwd.Text) Then
userID = combo_user.Text
UserPow = rs_login.Fields(2)
rs_login.Close
Unload Me
frmmain.Show
Else
MsgBox "密码不正确", vbOKOnly + vbExclamation, ""
txtPwd.SetFocus
End If
End If
End If
cnt = cnt + 1
If cnt = 3 Then
Unload Me
End If
Exit Sub
End Sub
Private Sub asPopup2_Click(Cancel As Boolean)
Unload Me
End Sub
Private Sub Form_Load()
XPForm1.Make
Dim str1 As String
Dim str2 As String
str1 = GetSetting(appname:="MyApp", Section:="Text1", Key:="Value", Default:="此处可自己设定")
str2 = GetSetting(appname:="MyApp", Section:="text2", Key:="Value", Default:="可以自己设定的")
frmLogin.XPForm1.Caption = str2
Dim txtsql As String
Dim mrc As ADODB.Recordset
Dim i As Integer
Dim connectionstring As String
connectionstring = "provider=Microsoft.Jet.oledb.4.0;" & _
"data source=" & App.path & "\jk.mdb"
conn.Open connectionstring
combo_user.Text = Me.Caption
txtsql = "select * from 密码表"
Set mrc = conn.Execute(txtsql)
Do While Not mrc.EOF
combo_user.AddItem mrc.Fields(0)
mrc.MoveNext
Loop
combo_user.Text = combo_user.List(0)
mrc.Close
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set conn = Nothing
End Sub
Private Sub txtPwd_KeyPress(KeyAscii As Integer)
'Horizontal Me, RGB(131, 166, 244), RGB(33, 120, 224)
'Horizontal Me, &HB9C4B9, &HFF8080
'Horizontal Me, &HFF8080, 210
'Horizontal Me, 210, RGB(131, 166, 244)
If (KeyAscii) = 13 Then
asPopup1_Click (1)
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -