📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Flogin
Caption = "用户登录"
ClientHeight = 3330
ClientLeft = 60
ClientTop = 450
ClientWidth = 5580
LinkTopic = "Form1"
ScaleHeight = 3330
ScaleWidth = 5580
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 3000
TabIndex = 5
Top = 2400
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "登陆"
Height = 495
Left = 1080
TabIndex = 4
Top = 2400
Width = 1215
End
Begin VB.TextBox Text2
Height = 495
IMEMode = 3 'DISABLE
Left = 2400
PasswordChar = "*"
TabIndex = 3
Top = 1440
Width = 2175
End
Begin VB.TextBox Text1
Height = 495
Left = 2400
TabIndex = 1
Top = 360
Width = 2175
End
Begin VB.Label Label2
Caption = "密码:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
TabIndex = 2
Top = 1440
Width = 1215
End
Begin VB.Label Label1
Caption = "用户名:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
TabIndex = 0
Top = 360
Width = 1215
End
End
Attribute VB_Name = "Flogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "用户名、密码不能为空", vbOKOnly, "警告"
If Text1.Text = "" Then
Text1.SetFocus
Else
Text2.SetFocus
End If
Exit Sub
End If
Dim strsql As String
Dim user As String
Dim code As String
Call connecttoserver
strsql = "select * from user where username='" & Text1.Text & "'"
runsql (strsql)
user = rct.Fields(0)
code = rct.Fields(1)
If user = Text1.Text And code = Text2.Text Then
Unload Me
grade = rct.Fields(2)
MDIForm1.Show
Else
MsgBox "用户名和密码错误,请重新输入", vbOKOnly, "警告"
Text1.SetFocus
End If
End Sub
Private Sub Command2_Click()
Unload Me
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -