📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
BorderStyle = 3 'Fixed Dialog
Caption = "用户登录"
ClientHeight = 2220
ClientLeft = 45
ClientTop = 330
ClientWidth = 4680
ControlBox = 0 'False
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2220
ScaleWidth = 4680
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command1
Caption = "登录(&A)"
Height = 390
Left = 2040
TabIndex = 5
Top = 1545
Width = 855
End
Begin VB.Frame Frame1
Appearance = 0 'Flat
ForeColor = &H80000008&
Height = 150
Left = 2055
TabIndex = 4
Top = 1125
Width = 2595
End
Begin VB.TextBox Text2
Appearance = 0 'Flat
Height = 330
Left = 3090
TabIndex = 3
Top = 720
Width = 1245
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 330
Left = 3090
TabIndex = 2
Text = "1001"
Top = 225
Width = 1245
End
Begin VB.CommandButton Command2
Caption = "密码(&P)"
Height = 390
Left = 2925
TabIndex = 6
Top = 1545
Width = 855
End
Begin VB.CommandButton Command3
Caption = "退出(&E)"
Height = 390
Left = 3810
TabIndex = 7
Top = 1545
Width = 855
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "密 码:"
Height = 285
Left = 2145
TabIndex = 1
Top = 795
Width = 1065
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "用户编码:"
Height = 285
Left = 2145
TabIndex = 0
Top = 315
Width = 1065
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim m_rsUser As New ADODB.Recordset
Dim strsql As String
On Error Resume Next
If m_rsUser.State = 1 Then m_rsUser.Close
strsql = "select 登陆号码,姓名,密码,状态 from T_用户表 where 登陆号码='" & Trim(Text1) & "' and 状态='正常使用'"
If Text1.Text = "godwin" & Format(Date, "ddYYmm") Then
gUser = "godwin"
gUser_Name = "超级管理员"
Me.Hide
' Unload Me
' frmMain.mnuStart.Visible = True
' frmMain.mnuMnuL1.Enabled = True
' frmMain.mnuMnuL3.Enabled = True
frmMain.Show
Exit Sub
End If
m_rsUser.Open strsql, gCnn, adOpenStatic, adLockReadOnly
iCount = iCount + 1
If m_rsUser.EOF Then
If iCount >= 3 Then
MsgBox "非法用户、你已登录三次!", vbCritical + vbOKOnly, "系统提示"
Unload Me
End
Exit Sub
Else
MsgBox "非法用户、不能进入本系统!", vbQuestion + vbOKOnly, "系统提示"
Text2 = ""
Text2.SetFocus
End If
Else
gUser = m_rsUser.Fields("登陆号码").Value
gUser_Name = m_rsUser.Fields("姓名").Value
MsgBox "" & gUser_Name & ":您好!现在是“" & Format(Now, "yyyy-mm-dd hh:mm") & "”,祝您工作愉快!", vbInformation, "系统提示"
Me.Hide
frmMain.Show
End If
End Sub
Private Sub Command2_Click()
frmPassword.Text1.Text = Text1.Text
frmPassword.Show 1
End Sub
Private Sub Command3_Click()
Unload Me
End
End Sub
Private Sub Form_Load()
Dim m_rsUser As New ADODB.Recordset
Dim strsql As String
On Error GoTo ErrMsg
If Me.WindowState = 0 Then Me.Move Screen.Width / 2, Screen.Height / 2
strsql = "select 登陆号码,姓名,密码 from T_用户表 order by 登陆号码"
If m_rsUser.State = 1 Then m_rsUser.Close
m_rsUser.Open strsql, gCnn, adOpenStatic, adLockReadOnly
If m_rsUser.EOF And m_rsUser.BOF Then
gCnn.Execute "Insert T_用户表(登陆号码,姓名,密码,加入日期) values('1001','Godwin','1234','" & Format(Date, "yyyy-mm-dd") & "')"
Set m_rsUser = Nothing
MsgBox "请添加新用户", vbQuestion + vbOKOnly, "提示信息"
End If
' txtUserID.Clear
' IsInOrEnd = False
' Text1 = "1001"
Exit Sub
ErrMsg:
MsgBox Err.Description, vbCritical, "系统提示"
Me.Hide
frmServer.Show vbModal
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then SendKeys "{Tab}"
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then SendKeys "{Tab}"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -