📄 登录.frm
字号:
VERSION 5.00
Begin VB.Form 登录1
BorderStyle = 3 'Fixed Dialog
Caption = "登录"
ClientHeight = 1650
ClientLeft = 2835
ClientTop = 3480
ClientWidth = 3960
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Picture = "登录.frx":0000
ScaleHeight = 974.874
ScaleMode = 0 'User
ScaleWidth = 3718.226
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox txtUserName
BeginProperty Font
Name = "楷体_GB2312"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 345
Left = 1290
TabIndex = 1
Top = 120
Width = 2325
End
Begin VB.CommandButton cmdOK
Caption = "确定"
Default = -1 'True
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 390
Left = 495
TabIndex = 4
Top = 1020
Width = 1140
End
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取消"
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 390
Left = 2160
TabIndex = 5
Top = 1020
Width = 1140
End
Begin VB.TextBox txtPassword
BeginProperty Font
Name = "楷体_GB2312"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 345
IMEMode = 3 'DISABLE
Left = 1290
PasswordChar = "*"
TabIndex = 3
Top = 525
Width = 2325
End
Begin VB.Label lblLabels
BackStyle = 0 'Transparent
Caption = "用户名称(&U):"
BeginProperty Font
Name = "楷体_GB2312"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 270
Index = 0
Left = 120
TabIndex = 0
Top = 150
Width = 1080
End
Begin VB.Label lblLabels
BackStyle = 0 'Transparent
Caption = "密码(&P):"
BeginProperty Font
Name = "楷体_GB2312"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 390
Index = 1
Left = 120
TabIndex = 2
Top = 480
Width = 1305
End
End
Attribute VB_Name = "登录1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Private Sub cmdcancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim str As String
cnn.Open myApp.cnnstr
str = "select * from 用户 where 用户名='" & Trim(txtUserName.Text) & "'"
rst.Open str, cnn, 1, 1 '打开记录集,查找用户表中是否有该用户
If rst.EOF Then
MsgBox "没有此用户", vbCritical, "错误"
Else
If rst!密码 <> Trim(txtPassword.Text) Then
MsgBox "密码错误", vbCritical, "错误"
Else
'给全局变量赋值,以便以后使用
myApp.logined = True
myApp.uId = rst!用户名
myApp.pwd = rst!密码
myApp.auth = rst!权限
主窗体.refreshmenu (myApp.auth) '根据用户权限刷新菜单
Unload Me
End If
End If
rst.Close
cnn.Close
End Sub
Private Sub Form_Load()
txtUserName.Text = "yyy"
txtPassword.Text = "yyy"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -