?? frmlogin.frm
字號:
VERSION 5.00
Begin VB.Form frmLogin
BorderStyle = 3 'Fixed Dialog
Caption = "操作員確認"
ClientHeight = 1635
ClientLeft = 2835
ClientTop = 3480
ClientWidth = 4065
ControlBox = 0 'False
Icon = "frmLogin.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 966.012
ScaleMode = 0 'User
ScaleWidth = 3816.815
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.ComboBox cbUserName
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 1440
TabIndex = 0
Top = 150
Width = 2415
End
Begin VB.CommandButton cmdExit
Caption = "退 出"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 390
Left = 2670
TabIndex = 6
Top = 1110
Width = 1140
End
Begin VB.CommandButton cmdOK
Caption = "確 定"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 390
Left = 120
TabIndex = 2
Top = 1110
Width = 1140
End
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取 消"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 390
Left = 1350
TabIndex = 3
Top = 1110
Width = 1140
End
Begin VB.TextBox txtPassword
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
IMEMode = 3 'DISABLE
Left = 1440
PasswordChar = "*"
TabIndex = 1
Top = 555
Width = 2385
End
Begin VB.Label lblLabels
Alignment = 2 'Center
Caption = "操作員(&U):"
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 225
Index = 0
Left = 150
TabIndex = 4
Top = 180
Width = 1170
End
Begin VB.Label lblLabels
Alignment = 2 'Center
Caption = "密 碼(&P):"
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 225
Index = 1
Left = 120
TabIndex = 5
Top = 630
Width = 1170
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'取消當前登錄輸入
Private Sub cmdCancel_Click()
LoginSucceeded = False
txtPassword.Text = ""
cbUserName.Text = ""
cbUserName.SetFocus
End Sub
'退出系統
Private Sub CmdExit_Click()
End
End Sub
'登錄確認
Private Sub cmdOK_Click()
Dim adoRs As New ADODB.Recordset
Dim sSQL As String
Dim sPassWord As String
sOperator = cbUserName.Text
sPassWord = txtPassword.Text
sSQL = " SELECT * FROM t_account" _
& " WHERE user='" & sOperator & "' AND pwd='" & sPassWord & "'"
'檢查密碼的正確性
adoRs.Open sSQL, CN, adOpenForwardOnly, adLockReadOnly
If adoRs.EOF And adoRs.BOF Then
MsgBox "無效的用戶名或密碼,再試一次!", vbInformation, "系統確認"
cbUserName.SetFocus
Else
sPopedom = Trim(adoRs![power])
LoginSucceeded = True
Unload Me
End If
End Sub
'用戶名按鍵
Private Sub cbUserName_KeyPress(KeyAscii As Integer)
txtPassword.SetFocus
End Sub
'窗體載入
Private Sub Form_Load()
Dim adoRs As New ADODB.Recordset
Dim sSQL As String
'打開操作權限表
sSQL = "SELECT user,pwd,power FROM t_account"
adoRs.Open sSQL, CN, adOpenStatic, adLockReadOnly
Do While Not adoRs.EOF
cbUserName.AddItem adoRs![user]
adoRs.MoveNext
Loop
adoRs.Close
End Sub
'確定
Private Sub txtPassword_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
cmdOK_Click
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -