📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
BorderStyle = 1 'Fixed Single
Caption = "用户登录"
ClientHeight = 2880
ClientLeft = 4725
ClientTop = 4365
ClientWidth = 4710
Icon = "frmLogin.frx":0000
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2880
ScaleWidth = 4710
Begin VB.TextBox t_password
Height = 270
IMEMode = 3 'DISABLE
Left = 1920
MaxLength = 8
PasswordChar = "*"
TabIndex = 6
Top = 1065
Width = 1935
End
Begin VB.TextBox t_id
Height = 270
Left = 1920
MaxLength = 8
TabIndex = 5
Top = 465
Width = 1935
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = 1920
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "密码表"
Top = 0
Visible = 0 'False
Width = 1740
End
Begin VB.CommandButton Command2
Caption = "取消(&C)"
Height = 495
Left = 2880
TabIndex = 3
Top = 2160
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "确定(&Y)"
Height = 495
Left = 480
TabIndex = 2
Top = 2160
Width = 1215
End
Begin VB.Label Label3
ForeColor = &H000000FF&
Height = 255
Left = 1440
TabIndex = 4
Top = 1680
Width = 2295
End
Begin VB.Label Label2
Caption = "密 码:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 1
Top = 1080
Width = 1215
End
Begin VB.Label Label1
Caption = "用户名称:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
TabIndex = 0
Top = 480
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 myheight, mywidth As Integer '保持窗体大小的相关声明
Private Sub Command1_Click()
'检查用户名和密码
If t_id.Text = "" And t_password.Text = "" Then
Label3.Caption = "请输入用户名和密码!"
Else
If t_id.Text = "" Then
Label3.Caption = "请输入用户名!"
t_id.SetFocus
Else
If t_password.Text = "" Then
Label3.Caption = "请输入密码!"
t_password.SetFocus
Else
Dim user As String
user = "useid=" & "'" & Trim(t_id.Text) & "' and " + "password=" & "'" & Trim(t_password.Text) & "'"
Data1.Recordset.FindFirst user
If Data1.Recordset.NoMatch Then
Label3.Caption = "没有该用户,或密码错误!"
Exit Sub
Else
frmMain.Show
frmPWupdate.Label5.Caption = t_id.Text '记录传递用户名
Unload Me
Unload form1
End If
End If
End If
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
mywidth = Me.Width '保持窗体大小
myheight = Me.Height
Data1.DatabaseName = App.Path + "\水电费管理系统数据库.mdb"
Data1.RecordSource = "密码表"
End Sub
Private Sub Form_Resize()
Me.Height = myheight '保持窗体大小
Me.Width = mywidth
End Sub
Private Sub t_id_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then SendKeys "{tab}" '用户名框中按回车,焦点移至密码文本框
End Sub
Private Sub t_password_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Command1_Click '输完密码后,按回车,等同于按"确定"按钮
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -