📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmlogin
BorderStyle = 0 'None
Caption = "登陆"
ClientHeight = 4485
ClientLeft = 0
ClientTop = 0
ClientWidth = 6000
LinkTopic = "Form1"
MaxButton = 0 'False
Picture = "frmlogin.frx":0000
ScaleHeight = 4485
ScaleWidth = 6000
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.ComboBox cmbo用户名
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 2400
Style = 2 'Dropdown List
TabIndex = 0
Top = 1800
Width = 2175
End
Begin VB.TextBox txt密码
Appearance = 0 'Flat
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 = 2400
PasswordChar = "*"
TabIndex = 1
Top = 2595
Width = 2175
End
Begin VB.CommandButton cmdexit
Cancel = -1 'True
Caption = "取 消"
Height = 375
Left = 3360
TabIndex = 3
Top = 3480
Width = 1215
End
Begin VB.CommandButton cmdok
Caption = "确 认"
Default = -1 'True
Height = 375
Left = 1320
TabIndex = 2
Top = 3480
Width = 1215
End
Begin VB.Label Label2
Alignment = 2 'Center
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用 户 名:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 1320
TabIndex = 5
Top = 1860
Width = 1215
End
Begin VB.Label Label1
Alignment = 2 'Center
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "密 码:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 1320
TabIndex = 4
Top = 2655
Width = 1215
End
End
Attribute VB_Name = "frmlogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cnt As Integer
Option Explicit
Private Sub cmdexit_Click()
If MsgBox("确定退出系统吗?", vbQuestion + vbYesNo, "退出系统") = vbYes Then
Unload Me
End If
End Sub
Private Sub cmdok_Click()
Dim rs As New ADODB.Recordset
Dim sql As String
If Screen.Width < 15360 Then
MsgBox "请设高系统的分辨率,最好在1024*768下运行该系统,才能进入系统。", vbCritical + vbOKOnly, "屏幕分辨率"
Unload Me
End If
If Trim(cmbo用户名.Text) = "" Then
MsgBox "没有这个用户", vbOKOnly + vbExclamation, "登陆错误"
cmbo用户名.SetFocus
ElseIf Trim(txt密码.Text) = "" Then
MsgBox "密码不能为空", vbOKOnly + vbExclamation, "登陆错误"
txt密码.SetFocus
Else
cnt = cnt + 1
sql = "select * from yhxxb where 用户名='" & cmbo用户名.Text & "'" 'yhxxb用户信息表
Set rs = TransactSQL(sql)
If Trim(rs.Fields(1)) = Trim(txt密码.Text) Then
user = cmbo用户名.Text
rs.Close
Unload Me
frmabout.Show
ElseIf cnt = 3 Then
MsgBox "密码三次不正确,退出系统!", vbOKOnly + vbInformation, "信息"
Unload Me
Else
MsgBox "密码不正确", vbOKOnly + vbExclamation, "错误"
txt密码.Text = ""
txt密码.SetFocus
End If
End If
End Sub
Private Sub Form_Load()
cnt = 0
'Me.Picture = LoadPicture(App.Path & "\login.jpg")
Dim rs As New ADODB.Recordset
Dim sql As String
sql = "select 用户名 from yhxxb"
Set rs = TransactSQL(sql)
While Not rs.EOF
cmbo用户名.AddItem rs(0)
rs.MoveNext
Wend
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -