📄 main.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "登录界面"
ClientHeight = 5505
ClientLeft = 60
ClientTop = 405
ClientWidth = 6915
LinkTopic = "Form1"
Picture = "main.frx":0000
ScaleHeight = 5505
ScaleWidth = 6915
StartUpPosition = 3 'Windows Default
Begin VB.Timer Timer1
Enabled = 0 'False
Left = 6240
Top = 2040
End
Begin VB.CommandButton Command4
Caption = "退出"
Height = 495
Left = 3960
TabIndex = 8
Top = 4320
Width = 975
End
Begin VB.CommandButton Command3
Caption = "注册"
Height = 495
Left = 2760
TabIndex = 7
Top = 4320
Width = 975
End
Begin VB.CommandButton Command2
Caption = "清空"
Height = 495
Left = 1560
TabIndex = 6
Top = 4320
Width = 975
End
Begin VB.CommandButton Command1
Caption = "登录"
Height = 495
Left = 360
TabIndex = 5
Top = 4320
Width = 975
End
Begin VB.TextBox Text2
Height = 495
IMEMode = 3 'DISABLE
Left = 1680
PasswordChar = "*"
TabIndex = 4
Top = 3240
Width = 1695
End
Begin VB.TextBox Text1
Height = 495
Left = 1680
TabIndex = 2
Top = 1800
Width = 2655
End
Begin VB.Label Label5
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "光临"
BeginProperty Font
Name = "Bodoni MT Black"
Size = 26.25
Charset = 0
Weight = 900
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000018&
Height = 495
Left = 3120
TabIndex = 10
Top = 480
Width = 1215
End
Begin VB.Label Label4
Alignment = 2 'Center
BackColor = &H8000000D&
BackStyle = 0 'Transparent
Caption = "欢迎"
BeginProperty Font
Name = "Bodoni MT Black"
Size = 21.75
Charset = 0
Weight = 900
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000018&
Height = 495
Left = 1680
TabIndex = 9
Top = 600
Width = 1215
End
Begin VB.Label Label3
Caption = "(用身份证作为用户名)"
Height = 255
Left = 360
TabIndex = 3
Top = 2640
Width = 2175
End
Begin VB.Label Label2
Alignment = 2 'Center
Caption = "密码:"
Height = 375
Left = 360
TabIndex = 1
Top = 3240
Width = 855
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "用户名:"
Height = 375
Left = 360
TabIndex = 0
Top = 1920
Width = 975
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim Login_user_ID As String
Private Sub Command1_Click()
'Call databaseopen
Dim textSQL As String
If Trim(Text1.Text = "") Then
MsgBox "用户名不能为空!", vbOKOnly + vbExclamation, "警告"
Text1.SetFocus
Else
textSQL = "select Login_user_ID=用户名 from user_inf where 用户名 = '" & Text1.Text & "' and 密码='" & Text2.Text & "'"
Set rst = New ADODB.Recordset
rst.Open Trim$(textSQL), conn
If rst.EOF = True Then
MsgBox "用户名或密码错误,请重新输入!", vbOKOnly + vbExclamation, "警告"
Text2 = ""
Text2.SetFocus
Else
mainmenu.Show
conn.Close
Unload Form1
'Form1.Hide
' Call databaseclose
End If
End If
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
End Sub
Private Sub Command3_Click()
zhuce.Show
Unload Me
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 30
Label4.Top = Label5.Top = 100
Label4.Left = 0
Label5.Left = Form1.Width
Dim ConnectString As String
Set conn = New ADODB.Connection
ConnectString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;" _
& "Persist Security Info=False;Initial Catalog=陈念;" _
& "Data Source=3302A68391D44A0"
conn.CursorLocation = adUseClient
conn.Open ConnectString
End Sub
Private Sub Timer1_Timer()
Label4.Left = Label4.Left + 20
Label5.Left = Label5.Left - 20
If Label4.Left >= Form1.Width / 2 Then
Label4.Left = 0
End If
If Label5.Left <= Form1.Width / 2 Then
Label5.Left = Form1.Width
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -