📄 frmlogin.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmLogin
BackColor = &H00FFC0C0&
BorderStyle = 1 'Fixed Single
Caption = "登录"
ClientHeight = 3120
ClientLeft = 2835
ClientTop = 3480
ClientWidth = 5565
ControlBox = 0 'False
ForeColor = &H00000000&
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Moveable = 0 'False
Picture = "frmLogin.frx":0000
ScaleHeight = 1843.399
ScaleMode = 0 'User
ScaleWidth = 5225.232
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 3960
Top = 1920
Visible = 0 'False
Width = 1335
_ExtentX = 2355
_ExtentY = 661
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.ComboBox txtusername
Height = 300
Left = 2400
TabIndex = 5
Top = 840
Width = 2175
End
Begin VB.CommandButton cmdOK
BackColor = &H00FFFFFF&
Caption = "确定"
Default = -1 'True
Height = 390
Left = 1320
Style = 1 'Graphical
TabIndex = 3
Top = 2280
Width = 900
End
Begin VB.CommandButton cmdCancel
BackColor = &H00FFFFFF&
Cancel = -1 'True
Caption = "取消"
Height = 390
Left = 3000
Style = 1 'Graphical
TabIndex = 4
Top = 2280
Width = 900
End
Begin VB.TextBox txtPassword
Height = 345
IMEMode = 3 'DISABLE
Left = 2400
PasswordChar = "*"
TabIndex = 2
Top = 1440
Width = 2115
End
Begin VB.Label Label1
Alignment = 2 'Center
BackColor = &H80000005&
BackStyle = 0 'Transparent
Caption = "身 份 验 证"
BeginProperty Font
Name = "幼圆"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = -120
TabIndex = 6
Top = 120
Width = 3255
End
Begin VB.Label lblLabels
BackStyle = 0 'Transparent
Caption = "用户名"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 0
Left = 1200
TabIndex = 0
Top = 840
Width = 1080
End
Begin VB.Label lblLabels
BackStyle = 0 'Transparent
Caption = "密 码"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 1
Left = 1200
TabIndex = 1
Top = 1440
Width = 1080
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, nSize As Long) As Long
Private Declare Function Getuserpassword Lib "" ()
Public OK As Boolean
Dim xUserName As String
Dim sBuffer As String
Dim lSize As Long
Public LoginSucceeded As Boolean
Private Sub cmdCancel_Click()
End
End Sub
Private Sub cmdOK_Click()
With Adodc1.Recordset
If .EOF Then
MsgBox "无此用户,请重新选择!", vbExclamation, "登录"
Else
If txtusername.Text = !用户名 And txtPassword.Text = !密码 Then
quanxian = !权限
OK = True
Me.Hide
If quanxian = "admin" Then
MDIForm1.Show
Else
MDIForm1.Show
MDIForm1.JHJ.Enabled = False
MDIForm1.xstj.Enabled = False
MDIForm1.anpai.Enabled = False
MDIForm1.anp.Enabled = False
' MDIForm1.jiaoshi.Enabled = False
MsgBox "对不起没有登陆权限!", , "登录"
End If
Else
MsgBox "密码错误,请重新输入!", , "登录"
txtPassword.SetFocus
End If
End If
End With
End Sub
Private Sub Combo1_Change()
Adodc1.RecordSource = "select *from 用户表 where 用户名= '" & Trim(txtusername) & "'"
Adodc1.Refresh
txtPassword = ""
End Sub
Private Sub Form_Load()
txtPassword.Text = ""
Adodc1.ConnectionString = Connection
Adodc1.RecordSource = "select *from 用户表"
Adodc1.Refresh
With Adodc1.Recordset
While Not .EOF And Not .BOF
txtusername.AddItem !用户名
.MoveNext
Wend
End With
Adodc1.Refresh
End Sub
Private Sub txtPassword_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
Call cmdOK_Click
End If
End Sub
Private Sub txtusername_Click()
Adodc1.RecordSource = "select *from 用户表 where 用户名= '" & Trim(txtusername) & "'"
Adodc1.Refresh
txtPassword = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -