📄 form10.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
BackColor = &H00E0E0E0&
Caption = "登录"
ClientHeight = 4545
ClientLeft = 60
ClientTop = 450
ClientWidth = 5895
LinkTopic = "Form10"
ScaleHeight = 4545
ScaleMode = 0 'User
ScaleWidth = 2500
Begin VB.CommandButton cmdCancel
Caption = "取 消"
Height = 495
Left = 3960
TabIndex = 8
Top = 3720
Width = 1215
End
Begin VB.Frame Frame1
BackColor = &H00E0E0E0&
Height = 2295
Left = 600
TabIndex = 2
Top = 1080
Width = 4575
Begin VB.TextBox UsName
Height = 495
Left = 1680
TabIndex = 4
Top = 720
Width = 2055
End
Begin VB.TextBox Pwd
Height = 495
IMEMode = 3 'DISABLE
Left = 1680
PasswordChar = "*"
TabIndex = 3
Top = 1320
Width = 2055
End
Begin VB.Label Label1
BackColor = &H00E0E0E0&
Caption = "用户名:"
Height = 375
Left = 480
TabIndex = 6
Top = 840
Width = 1095
End
Begin VB.Label Label2
BackColor = &H00E0E0E0&
Caption = "密 码:"
Height = 375
Left = 480
TabIndex = 5
Top = 1440
Width = 1095
End
End
Begin VB.CommandButton cmdReLogin
Caption = "重 填"
Height = 495
Left = 2280
TabIndex = 1
Top = 3720
Width = 1215
End
Begin VB.CommandButton cmdLogin
Caption = "确 定"
Height = 495
Left = 600
TabIndex = 0
Top = 3720
Width = 1215
End
Begin VB.Label Label3
BackColor = &H00E0E0E0&
Caption = "小区物业管理系统"
BeginProperty Font
Name = "宋体"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 495
Left = 1200
TabIndex = 7
Top = 360
Width = 3615
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public OK As Boolean
Dim miCount As Integer
Private Sub cmdCancel_Click()
OK = False
End
End Sub
Private Sub cmdLogin_Click()
Dim rs_user As New ADODB.Recordset
Dim txtSQL As String
Dim MsgText As String
If UsName.Text = "" Then
MsgBox "用户名不能为空,请输入用户名!", vbOKOnly + vbInformation, "注意"
UsName.SetFocus
Exit Sub
Else
If Pwd.Text = "" Then
MsgBox "请输入密码!", vbOKOnly + vbInformation, "注意"
Pwd.SetFocus
Exit Sub
Else
txtSQL = "select * from UserTable where userId='" & UsName.Text & "'"
Set rs_user = ExecuteSQL(txtSQL, MsgText)
If rs_user.EOF = True Then
MsgBox "没有这个用户,请重新输入你的用户名!", vbOKOnly + vbInformation, "注意"
UsName.SetFocus
Else
If Trim(rs_user.Fields(1)) = Trim(Pwd.Text) Then
OK = True
rs_user.Close
Me.Hide
UserName = Trim(UsName.Text)
FrmMain.Show
Else
MsgBox "输入密码不正确,请重新输入!", vbOKOnly + vbInformation, "注意"
Pwd.SetFocus
Pwd.Text = " "
End If
End If
End If
miCount = miCount + 1
If miCount = 3 Then
Me.Hide
End If
End If
End Sub
Private Sub cmdReLogin_Click()
UsName.Text = ""
Pwd.Text = ""
End Sub
Private Sub Form_Load()
frmLogin.Width = 6015
frmLogin.Height = 5220
Dim x0 As Long '居中显示
Dim y0 As Long
x0 = Screen.Width
y0 = Screen.Height
x0 = (x0 - Me.Width) / 2
y0 = (y0 - Me.Height) / 2
Me.Move x0, y0
OK = False
miCount = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -