📄 login.frm
字号:
VERSION 5.00
Begin VB.Form 登录窗口
Caption = "登录窗口"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form3"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Height = 2895
Left = 53
TabIndex = 0
Top = 98
Width = 4575
Begin VB.TextBox Text2
Height = 375
Left = 1560
TabIndex = 6
Text = "Text2"
Top = 1680
Width = 2055
End
Begin VB.TextBox Text1
Height = 375
Left = 1560
TabIndex = 5
Text = "Text1"
Top = 960
Width = 2055
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 2520
TabIndex = 2
Top = 2400
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "登录"
Height = 375
Left = 840
TabIndex = 1
Top = 2400
Width = 975
End
Begin VB.Label Label3
Alignment = 2 'Center
Caption = "用 户 登 录"
BeginProperty Font
Name = "黑体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
TabIndex = 7
Top = 240
Width = 3375
End
Begin VB.Label Label2
Caption = "密码"
Height = 255
Left = 360
TabIndex = 4
Top = 1800
Width = 1095
End
Begin VB.Label Label1
Caption = "用户名"
Height = 255
Left = 360
TabIndex = 3
Top = 1080
Width = 1095
End
End
End
Attribute VB_Name = "登录窗口"
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
txtsql = "select 用户名,标识 from 用户 where 用户名='" & Trim(Text1.Text) & "'"
Set mrc = ExecuteSQL(txtsql)
If mrc.EOF = True Then
MsgBox " 用户名错误!", vbExclamation + vbOKOnly, "警告"
Text1.SetFocus
'Text1.SelStart = 0
'Text1.SelLength = Len(Text1.Text)
Exit Sub
End If
username = mrc.Fields(0)
qxstra = mrc.Fields(1)
mrc.Close
txtsql = "select 密码 from 用户 where 密码='" & Trim(Text2.Text) & "'"
Set mrc = ExecuteSQL(txtsql)
If mrc.EOF = True Then
MsgBox " 密码错误!", vbExclamation + vbOKOnly, "警告"
Text2.SetFocus
'Text2.SelStart = 0
'Text2.SelLength = Len(Text2.Text)
Exit Sub
End If
主窗体.Show
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -