📄 frmlogin.frm
字号:
VERSION 5.00
Object = "{E95A2510-F3D1-416D-823B-4F840FE98091}#3.0#0"; "COMMAND.OCX"
Begin VB.Form frmLogin
BorderStyle = 3 'Fixed Dialog
Caption = "frmLogin——用户登陆"
ClientHeight = 1545
ClientLeft = 2835
ClientTop = 3480
ClientWidth = 3750
Icon = "frmLogin.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Picture = "frmLogin.frx":08CA
ScaleHeight = 912.837
ScaleMode = 0 'User
ScaleWidth = 3521.047
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin CSCommand.Command cmdCancel
Height = 375
Left = 2400
TabIndex = 5
Top = 1080
Width = 975
_ExtentX = 1720
_ExtentY = 661
Icon = "frmLogin.frx":7C6DF
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
Appearance = 2
BackStyle = 0
End
Begin CSCommand.Command cmdOk
Height = 375
Left = 360
TabIndex = 4
Top = 1080
Width = 975
_ExtentX = 1720
_ExtentY = 661
Icon = "frmLogin.frx":7C9F9
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
Appearance = 2
BackStyle = 0
End
Begin VB.TextBox txtUserName
Height = 345
Left = 1320
TabIndex = 1
Top = 135
Width = 2325
End
Begin VB.TextBox txtPassword
Height = 345
IMEMode = 3 'DISABLE
Left = 1290
PasswordChar = "*"
TabIndex = 3
Top = 525
Width = 2325
End
Begin VB.Label lblLabels
BackStyle = 0 'Transparent
Caption = "用户名称(&U):"
Height = 270
Index = 0
Left = 105
TabIndex = 0
Top = 150
Width = 1080
End
Begin VB.Label lblLabels
BackStyle = 0 'Transparent
Caption = "密码(&P):"
Height = 270
Index = 1
Left = 105
TabIndex = 2
Top = 540
Width = 1080
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 Str As ADODB.Recordset
Dim Str1 As String
' Dim Acc As ADODB.Recordset
' Dim Acc1 As String
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOk_Click()
Set Str = New Recordset
Str1 = "Select * From UserMsg where UserName='" & txtUserName.Text & "'"
Str.Open Str1, cnStr, adOpenKeyset, adLockOptimistic, adCmdText
If Str.RecordCount < 0 Then Exit Sub
Str.Requery
' Str.Find "UserName='" & txtUserName & "'"
If txtUserName.Text = "" Then
MsgBox "请输入用户名", vbOKOnly + vbExclamation, "用户名验证"
txtUserName.SetFocus
Exit Sub
End If
If Str.EOF And Str.BOF Then
MsgBox "用户名或密码不正确,请重新输入!", vbOKOnly + vbExclamation, "用户名验证"
txtUserName.Text = ""
txtPassword.Text = ""
txtUserName.SetFocus
frmLogin.Refresh
Exit Sub
ElseIf Trim(txtPassword.Text) <> Trim(Str(2)) Then
MsgBox "密码错误,请重新输入!", vbOKOnly + vbExclamation, "密码验证"
txtPassword.Text = ""
txtPassword.SetFocus
Exit Sub
Else
Unload frmLogin
frmMain.Show
End If
Str.Close
Set Str = Nothing
End Sub
Private Sub Form_Load()
' Set Str = New Recordset
'
' Str1 = "Select * From UserMsg"
'
' Str.Open Str1, cnStr, adOpenKeyset, adLockOptimistic, adCmdText
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -