📄 login.frm
字号:
VERSION 5.00
Begin VB.Form Login
Caption = "登录界面"
ClientHeight = 3015
ClientLeft = 60
ClientTop = 465
ClientWidth = 6420
LinkTopic = "Form1"
ScaleHeight = 3015
ScaleWidth = 6420
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 3120
TabIndex = 5
Top = 2160
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "登录"
Height = 375
Left = 1440
TabIndex = 4
Top = 2160
Width = 1095
End
Begin VB.TextBox Text2
Height = 375
Left = 2400
TabIndex = 3
Top = 1200
Width = 1935
End
Begin VB.TextBox Text1
Height = 375
Left = 2400
TabIndex = 2
Top = 600
Width = 1935
End
Begin VB.Label Label2
Caption = "密 码:"
Height = 375
Left = 1200
TabIndex = 1
Top = 1320
Width = 975
End
Begin VB.Label Label1
Caption = "用户名:"
Height = 375
Left = 1200
TabIndex = 0
Top = 600
Width = 855
End
End
Attribute VB_Name = "Login"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim mrc As ADODB.Recordset
Dim txtSQL As String
Dim MsgText As String
If Trim(Text1 & " ") <> "" Then
txtSQL = "select * from pwwd where uid='" & Trim(Text1 & " ") & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = True Then
MsgBox "没有这个用户", vbOKOnly + vbExclamation, "登录"
Text1.SetFocus
Else
If Trim(Text2 & " ") = Trim(mrc!pwd) Then
Frm.Show
Me.Hide
Else
MsgBox "密码错误", vbOKOnly + vbExclamation, "登录"
Text2.SetFocus
Text2.SelStart = 0
Text2.SelLength = Len(Text2.Text)
End If
End If
Else
MsgBox "没有这个用户", vbOKOnly + vbExclamation, "登录"
Text1.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -