📄 den_frm.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form den_frm
BackColor = &H00FFC0FF&
Caption = "欢迎进入南昌市公交车查询系统"
ClientHeight = 5700
ClientLeft = 4920
ClientTop = 2550
ClientWidth = 6480
ControlBox = 0 'False
BeginProperty Font
Name = "宋体"
Size = 6.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
Picture = "den_frm.frx":0000
ScaleHeight = 5700
ScaleLeft = 1500
ScaleMode = 0 'User
ScaleWidth = 6480
Begin VB.CommandButton Command2
Appearance = 0 'Flat
BackColor = &H00FFC0C0&
Caption = "取消"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3840
Style = 1 'Graphical
TabIndex = 8
Top = 3960
Width = 1215
End
Begin VB.CommandButton Command1
Appearance = 0 'Flat
BackColor = &H00FFC0C0&
Caption = "确定"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2400
MaskColor = &H00FFC0C0&
Style = 1 'Graphical
TabIndex = 7
Top = 3960
Width = 1215
End
Begin MSAdodcLib.Adodc Ado
Height = 330
Left = 480
Top = 4560
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 6.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.ComboBox Combo1
BackColor = &H00FFC0C0&
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
ItemData = "den_frm.frx":7239
Left = 2400
List = "den_frm.frx":7243
TabIndex = 5
Top = 1800
Width = 2655
End
Begin VB.Timer Timer1
Interval = 200
Left = 120
Top = 960
End
Begin VB.TextBox Text2
BackColor = &H00FFC0C0&
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 375
IMEMode = 3 'DISABLE
Left = 2400
PasswordChar = "*"
TabIndex = 1
Top = 3360
Width = 2655
End
Begin VB.TextBox Text1
BackColor = &H00FFC0C0&
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 375
Left = 2400
TabIndex = 0
Top = 2520
Width = 2655
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "身份验证"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 495
Left = 840
TabIndex = 6
Top = 1800
Width = 1455
End
Begin VB.Label Label3
BackColor = &H00C0C0C0&
BackStyle = 0 'Transparent
BeginProperty Font
Name = "华文彩云"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 1215
Left = 240
TabIndex = 4
Top = 120
Width = 6135
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "密 码"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 495
Left = 840
TabIndex = 3
Top = 3360
Width = 1215
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "用 户 名"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 495
Left = 840
TabIndex = 2
Top = 2520
Width = 1215
End
End
Attribute VB_Name = "den_frm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public ok As Boolean
Dim i As Integer
Dim miCount As Integer
'利用TIMER控件,来显示登录界面的字,使得在不同的时刻出现
Private Sub Timer1_Timer()
i = i + 1
Select Case i
Case 1
Label3.Caption = Label3.Caption + "欢 "
Case 2
Label3.Caption = Label3.Caption + "迎 "
Case 3
Label3.Caption = Label3.Caption + "登 "
Case 4
Label3.Caption = Label3.Caption + "录 "
Case 5
Label3.Caption = Label3.Caption + "公 "
Case 6
Label3.Caption = Label3.Caption + "交 "
Case 7
Label3.Caption = Label3.Caption + "车 "
Case 8
Label3.Caption = Label3.Caption + "查 "
Case 9
Label3.Caption = Label3.Caption + "询 "
Case 10
Label3.Caption = Label3.Caption + "系 "
Case 11
Label3.Caption = Label3.Caption + "统 "
Case 12
Label3.Caption = ""
i = 0
End Select
End Sub
Private Sub Form_Load()
'利用ADO控件连接数据库
Ado.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db1.mdb;Persist Security Info=False"
Ado.CommandType = adCmdText
Ado.RecordSource = "select * from mange"
Ado.Refresh
Ado.Recordset.MoveFirst
'记录登录系统错误的次数
miCount = 0
End Sub
Private Sub Command2_Click()
ok = False
Unload Me
End Sub
Private Sub Command1_Click()
Dim a As Boolean
mange_name = ""
'user_name在模块里面已定义,这里是记录当前登录的用户名
user_name = Trim(Text1.Text)
If Combo1.Text = "" Then
MsgBox "没有选择身份验证,请选择!", vbOKOnly + vbExclamation, "警告"
End If
'管理员登录
If Combo1.Text = "管理员" Then
'看用户名是否为空
If Trim(Text1.Text = "") Then
MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
Text1.SetFocus
Else
On Error Resume Next
Ado.Recordset.Close
Ado.Recordset.Open "select * from mange where mange_name = '" & Text1.Text & "'"
If Ado.Recordset.EOF = True Then
MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
Text1.SetFocus
Else
'密码是否正确
If Trim(Ado.Recordset.Fields(1)) = Trim(Text2.Text) Then
ok = True
Ado.Recordset.Close
Unload Me
mange_name = Trim(Text1.Text)
houabout_frm.Show
Else
MsgBox "输入密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
Text2.SetFocus
Text2.Text = ""
End If
End If
End If
If a = True Then
'如果用户名和密码都正确,就会显示后台主界面
Ado.Recordset.Open "select * from mange where mange_name = '" & Text1.Text & "'"
If Trim(Ado.Recordset.Fields(0)) = Trim(Text1.Text) And Trim(Ado.Recordset.Fields(1)) = Trim(Text2.Text) Then
ok = True
Unload Me
houabout_frm.Show
Ado.Recordset.Close
End If
End If
Else
'如果选择为“大众用户”,则不要用户名和密码,直接点确定就可以登录前台主界面
If Combo1.Text = "大众用户" Then
Text1.Enabled = True
Text2.Enabled = True
ok = True
Unload Me
about_frm.Show
End If
End If
'记录登录错误码的次数,如果为五次则退出
miCount = miCount + 1
If miCount = 5 Then
Unload Me
End If
Exit Sub
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -