📄 form1.frm
字号:
EndProperty
Height = 300
Index = 1
Left = 360
TabIndex = 23
Top = 3240
Width = 1500
End
Begin VB.Line Line2
BorderColor = &H0080FFFF&
BorderWidth = 3
Index = 1
X1 = -120
X2 = 5340
Y1 = 3000
Y2 = 3000
End
Begin VB.Label lb8
BackStyle = 0 'Transparent
ForeColor = &H000000FF&
Height = 1455
Left = 630
TabIndex = 15
Top = 4080
Width = 4215
End
Begin VB.Label lb7
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "经过该站台的公交车号:"
Height = 240
Left = 2400
TabIndex = 12
Top = 1680
Width = 2520
End
Begin VB.Label lb6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "站 台 名:"
Height = 240
Index = 0
Left = 240
TabIndex = 11
Top = 1680
Width = 1080
End
Begin VB.Line Line2
BorderColor = &H0080FFFF&
BorderWidth = 3
Index = 0
X1 = 0
X2 = 5460
Y1 = 1560
Y2 = 1560
End
Begin VB.Label lb5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "停 靠 站:"
Height = 240
Left = 2415
TabIndex = 8
Top = 240
Width = 1080
End
Begin VB.Label Lb4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "车 号:"
Height = 240
Left = 210
TabIndex = 7
Top = 240
Width = 840
End
End
Begin VB.Frame Frame1
BackColor = &H00FFC0C0&
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 5790
Left = 240
TabIndex = 0
Top = 960
Width = 2430
Begin VB.CommandButton Cmb1
Caption = "查询"
Default = -1 'True
Height = 435
Left = 420
TabIndex = 4
Top = 960
Width = 1380
End
Begin VB.ComboBox Combo1
BackColor = &H00C0E0FF&
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 300
ItemData = "Form1.frx":073B
Left = 240
List = "Form1.frx":073D
Sorted = -1 'True
TabIndex = 3
Top = 480
Width = 1905
End
Begin VB.Label lb2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "站 台 名:"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Index = 1
Left = 360
TabIndex = 18
Top = 1680
Width = 1350
End
Begin VB.Line Line1
BorderColor = &H0080FFFF&
BorderWidth = 3
Index = 1
X1 = 0
X2 = 2520
Y1 = 3000
Y2 = 3000
End
Begin VB.Label lb3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "你想去的地方:"
Height = 240
Left = 360
TabIndex = 6
Top = 4200
Width = 1680
End
Begin VB.Label lb2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "你所在的地方:"
Height = 240
Index = 0
Left = 315
TabIndex = 5
Top = 3240
Width = 1560
End
Begin VB.Line Line1
BorderColor = &H0080FFFF&
BorderWidth = 3
Index = 0
X1 = 0
X2 = 2520
Y1 = 1560
Y2 = 1560
End
Begin VB.Label lb1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = " 车 号:"
Height = 240
Left = 105
TabIndex = 2
Top = 210
Width = 1440
End
End
End
Attribute VB_Name = "select_frm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Private Sub Cmb1_Click()
'提示选择车号
If Combo1.Text = "" Then
MsgBox "请你选择车号!", 16, "提示"
Exit Sub
End If
Ado.Recordset.Close
Ado.Recordset.Open "select * from db1 where 车号='" + Combo1.Text + " '"
'看你输入你车号是否登记
If Ado.Recordset.EOF Then
MsgBox "你所输入的车号还没登记", vbOKOnly + vbExclamation, "提示"
Else
'记录集中的数据用文本框来显示
txt4.Text = Combo1.Text
txt5.Text = Ado.Recordset.Fields("停靠站").value
xia_frm.Text1 = Ado.Recordset.Fields(4)
xia_frm.Text2 = Ado.Recordset.Fields(5)
End If
txt6.Text = ""
txt7.Text = ""
Text1.Text = ""
Command1.Enabled = True
End Sub
Private Sub Command4_Click()
'看你是否正确输入你想去的地方和你所在的地方
If Combo3.Text = "" Or Combo4.Text = "" Then
MsgBox "请你正确输入你所在的地方和你想去的地方!", vbOKOnly + vbExclamation, "提示"
End If
Ado.Recordset.Close
Ado.Recordset.Open "select * from bus_se where bus_sstop='" + Combo3.Text + "' and bus_estop='" + Combo4.Text + "'"
If Ado.Recordset.EOF Then
If Combo3.Text = "清" And Combo4.Text = "华" Then
MsgBox "请你正确输入!", vbOKOnly + vbExclamation, "提示"
End If
Else
Text1.Text = Ado.Recordset.Fields("bus_route").value
End If
Command1.Enabled = True
End Sub
Private Sub Command3_Click()
'看你是否正确选择车站名
If combo2.Text = "" Then
MsgBox "请你选择车站名!", vbOKOnly + vbExclamation, "提示"
Exit Sub
End If
Ado.Recordset.Close
Ado.Recordset.Open "select * from rotuie where Rotuie_name='" + combo2.Text + " '"
'看你输入的车站台是否存在
If Ado.Recordset.EOF Then
MsgBox "你所输入的车站台还没登记", vbOKOnly + vbExclamation, "提示"
Else
txt6.Text = combo2.Text
txt7.Text = Ado.Recordset.Fields("C_name").value
End If
Text1.Text = ""
Command3.Enabled = True
End Sub
Private Sub Combo1_GotFocus()
Cmb1.Enabled = True
txt4.Text = ""
txt5.Text = ""
txt7.Text = ""
txt6.Text = ""
End Sub
Private Sub Command1_Click()
'祥细资料框显示
xia_frm.Show
End Sub
Private Sub Command2_Click()
Me.Hide
End Sub
Private Sub Command5_Click()
End Sub
Private Sub Form_Load()
txt1.Text = ""
Ado.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\db1.mdb"
Ado.CommandType = adCmdText
Ado.RecordSource = "select * from driver_message"
Ado.RecordSource = "select * from bus_se"
Ado.RecordSource = "select * from rotuie"
Ado.RecordSource = "select * from db1"
Ado.Refresh
For a = 0 To Ado.Recordset.RecordCount - 1
Combo1.AddItem Ado.Recordset.Fields(0)
Ado.Recordset.MoveNext
Next
End Sub
Private Sub Timer1_Timer()
'采用获取时间
lb8.Caption = "欢迎你使用南昌市公交车查询系统" & Chr(10) + Chr(13) & Chr(10) + Chr(13) & Space(6) & Space(2) & "现在是:" & Time() & Chr(10) + Chr(13) & Chr(10) + Chr(13) & Space(6) & "监督电话:" + " 7106778"
End Sub
Private Sub txt3_Change()
Cmb2.Enabled = True
txt4.Text = ""
txt5.Text = ""
Combo1.Text = ""
Command1.Enabled = False
End Sub
'利用时间TIME控件来使得在不同时刻来显示
Private Sub Timer2_Timer()
i = i + 1
Select Case i
Case 1
txt1.Text = txt1.Text + "南 "
Case 2
txt1.Text = txt1.Text + "昌 "
Case 3
txt1.Text = txt1.Text + "市 "
Case 4
txt1.Text = txt1.Text + "公 "
Case 5
txt1.Text = txt1.Text + "交 "
Case 6
txt1.Text = txt1.Text + "车 "
Case 7
txt1.Text = txt1.Text + "查 "
Case 8
txt1.Text = txt1.Text + "询 "
Case 9
txt1.Text = txt1.Text + "系 "
Case 10
txt1.Text = txt1.Text + "统 "
Case 11
txt1.Text = txt1.Text + "统 "
Case 12
txt1.Text = txt1.Text + "统 "
txt1.Text = ""
i = 0
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -