📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmlogin
BorderStyle = 3 'Fixed Dialog
Caption = "请登录"
ClientHeight = 1950
ClientLeft = 45
ClientTop = 330
ClientWidth = 4260
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1950
ScaleWidth = 4260
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.Frame fralogin
Caption = "登录"
Height = 1695
Left = 240
TabIndex = 2
Top = 120
Width = 2775
Begin VB.TextBox txtpwd
Height = 320
IMEMode = 3 'DISABLE
Left = 1200
PasswordChar = "*"
TabIndex = 5
Top = 750
Width = 1335
End
Begin VB.TextBox txtuser
Height = 320
Left = 1200
TabIndex = 4
Top = 255
Width = 1335
End
Begin VB.ComboBox cbousertype
Height = 300
ItemData = "frmlogin.frx":0000
Left = 1200
List = "frmlogin.frx":000D
TabIndex = 3
Top = 1200
Width = 1335
End
Begin VB.Label lb1labels
AutoSize = -1 'True
Caption = "选择身份:"
Height = 180
Index = 2
Left = 240
TabIndex = 8
Top = 1320
Width = 720
End
Begin VB.Label lb1labels
AutoSize = -1 'True
Caption = "口令:"
Height = 180
Index = 1
Left = 210
TabIndex = 7
Top = 840
Width = 720
End
Begin VB.Label lb1labels
AutoSize = -1 'True
Caption = "用户名:"
Height = 180
Index = 0
Left = 210
TabIndex = 6
Top = 360
Width = 720
End
End
Begin VB.CommandButton cmdcancel
Cancel = -1 'True
Caption = "取消"
Height = 375
Left = 3240
TabIndex = 1
Top = 1080
Width = 855
End
Begin VB.CommandButton cmdok
Caption = "确定"
Default = -1 'True
Height = 375
Left = 3240
TabIndex = 0
Top = 480
Width = 855
End
End
Attribute VB_Name = "frmlogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mnusertype As Integer
Private Sub cbousertype_Change()
mnusertype = cbousertype.ListIndex
End Sub
Private Sub cbousertype_Click()
mnusertype = cbousertype.ListIndex
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim user As String, pwd As String
user = txtuser
pwd = txtpwd
Dim r As New ADODB.Recordset
Set r = DataEnv.rssqlteaseek
Dim strsql As String
Select Case mnusertype
Case 0: strsql = "select * from tab_admin where name='" & user & "' and pwd='" & pwd & "'"
Case 1: strsql = "select * from tab_jsdyxx where name='" & user & "'and code='" & pwd & "'"
Case 2: strsql = "select * from tab_xsdyxx where name='" & user & "'and code='" & pwd & "'"
End Select
On Error Resume Next
If r.State = adStateOpen Then r.Close
r.Open strsql
Static count As Integer
If r.EOF Then
MsgBox "对不起,无此用户或者密码不正确!请重新输入!!", vbCritical, "错误"
txtuser.SetFocus
txtuser.SelStart = 0
txtuser.SelLength = Len(txtuser)
count = count + 1
If count >= 3 Then
MsgBox "您无权操作本系统!再见!", vbCritical, "无权限"
Unload Me
End If
Else
Load mdimain
With mdimain
.mnusertype = cbousertype.ListIndex
.mnusername = pwd
.Show
End With
Unload Me
End If
End Sub
Private Sub Form_Activate()
txtuser.SetFocus
End Sub
Private Sub Form_Load()
cbousertype.ListIndex = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -