📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BackColor = &H00C0FFC0&
Caption = "公交查询"
ClientHeight = 5835
ClientLeft = 60
ClientTop = 435
ClientWidth = 13020
LinkTopic = "Form1"
ScaleHeight = 5835
ScaleWidth = 13020
StartUpPosition = 3 '窗口缺省
Begin VB.ListBox List2
Height = 1860
ItemData = "Form1.frx":0000
Left = 1560
List = "Form1.frx":0002
TabIndex = 14
Top = 3480
Width = 1935
End
Begin VB.ListBox List1
Height = 1500
ItemData = "Form1.frx":0004
Left = 3720
List = "Form1.frx":0006
TabIndex = 13
Top = 600
Width = 2055
End
Begin VB.CommandButton Command1
BackColor = &H00AD734B&
Caption = "查询"
Height = 495
Left = 1560
Style = 1 'Graphical
TabIndex = 12
Top = 1800
Width = 1695
End
Begin VB.CommandButton Command4
BackColor = &H00AD734B&
Caption = "查询"
Height = 495
Left = 3960
Style = 1 'Graphical
TabIndex = 10
Top = 2760
Width = 1695
End
Begin VB.TextBox Text4
Height = 375
Left = 1560
TabIndex = 8
Top = 2880
Width = 1935
End
Begin VB.CommandButton Command3
BackColor = &H00AD734B&
Caption = "退出"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3960
Style = 1 'Graphical
TabIndex = 6
Top = 4560
Width = 1695
End
Begin VB.CommandButton Command2
BackColor = &H00AD734B&
Caption = "取消"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3960
Style = 1 'Graphical
TabIndex = 5
Top = 3600
Width = 1695
End
Begin VB.TextBox Text3
BackColor = &H00FFFFC0&
Height = 5415
Left = 6360
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 2
Top = 120
Width = 6375
End
Begin VB.TextBox Text2
Height = 375
Left = 1560
TabIndex = 1
Top = 1200
Width = 1815
End
Begin VB.TextBox Text1
Height = 375
Left = 1560
TabIndex = 0
Top = 360
Width = 1815
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "选择你想要输入的站点:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 255
Left = 3720
TabIndex = 16
Top = 240
Width = 2295
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "请你选择你想要输入的公交路线:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 735
Left = 0
TabIndex = 15
Top = 3600
Width = 1455
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "线路查询"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0080FFFF&
Height = 210
Left = 0
TabIndex = 11
Top = 2400
Width = 900
End
Begin VB.Shape Shape2
Height = 3015
Left = 0
Top = 2520
Width = 6015
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "请输入线路:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0080FFFF&
Height = 210
Left = 0
TabIndex = 9
Top = 3000
Width = 1350
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "站站查询"
ForeColor = &H0080FFFF&
Height = 375
Left = 0
TabIndex = 7
Top = 0
Width = 975
End
Begin VB.Shape Shape1
Height = 2295
Left = 0
Top = 120
Width = 6015
End
Begin VB.Label Label2
AutoSize = -1 'True
BackColor = &H00C0FFC0&
BackStyle = 0 'Transparent
Caption = "请输入终点:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 210
Left = 120
TabIndex = 4
Top = 1200
Width = 1350
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H00C0FFC0&
BackStyle = 0 'Transparent
Caption = "请输入起点:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 210
Left = 120
TabIndex = 3
Top = 480
Width = 1350
End
Begin VB.Image Image1
Height = 7335
Left = -120
Picture = "Form1.frx":0008
Stretch = -1 'True
Top = 0
Width = 13215
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim bs As Integer
Private Sub Command1_Click()
Dim DATABASE As String
DATABASE = "1.mdb"
Dim cnn As New ADODB.Connection
Dim ra As New ADODB.Recordset
Dim rb As New ADODB.Recordset
Dim rc As New ADODB.Recordset
Dim m, n, t, x, j, i, y As Integer
Const W = 13 '公交线线路数
Dim str1, str2 As String
Text3.Text = ""
str1 = Text1.Text
str2 = Text2.Text
m = 0: n = 0: t = 0: y = 0
Dim a(0 To W) As Integer
cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\" + DATABASE + ""
cnn.Open
ra.Open "select * from xianlu", cnn, adOpenDynamic, adLockOptimistic
'公交直达
Do While (Not ra.EOF)
For i = 2 To ra.Fields.Count - 1
If ra.Fields(i) = str1 Then
For j = 2 To ra.Fields.Count - 1
If ra.Fields(j) = str2 Then
a(y) = Abs(i - j)
If i < j Then
m = 1
Else
m = -1
End If
Dim str As String
For n = i To j Step m
str = str & ra.Fields(n) & " "
Next n
Text3.Text = Text3.Text & "你可以乘坐公交" + Trim(ra.Fields(1)) + "你经过的站点是:" & str & Chr(13) + Chr(10) & Chr(13) + Chr(10)
str = ""
End If
Next
End If
Next
y = y + 1
ra.MoveNext
Loop
Dim max As Integer
max = a(0)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -