⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 西安市的公交车查询
💻 FRM
📖 第 1 页 / 共 2 页
字号:
   End
   Begin VB.TextBox Text1 
      DataField       =   "station28"
      DataSource      =   "Adodc1"
      Height          =   270
      HideSelection   =   0   'False
      Index           =   28
      Left            =   4440
      TabIndex        =   23
      Text            =   "Text1"
      Top             =   1920
      Width           =   180
   End
   Begin VB.TextBox Text1 
      DataField       =   "station29"
      DataSource      =   "Adodc1"
      Height          =   270
      HideSelection   =   0   'False
      Index           =   29
      Left            =   4440
      TabIndex        =   22
      Text            =   "Text1"
      Top             =   1920
      Width           =   180
   End
   Begin VB.TextBox Text1 
      DataField       =   "station30"
      DataSource      =   "Adodc1"
      Height          =   270
      HideSelection   =   0   'False
      Index           =   30
      Left            =   4440
      TabIndex        =   21
      Text            =   "Text1"
      Top             =   1920
      Width           =   180
   End
   Begin VB.TextBox Text1 
      DataField       =   "station31"
      DataSource      =   "Adodc1"
      Height          =   270
      HideSelection   =   0   'False
      Index           =   31
      Left            =   4440
      TabIndex        =   20
      Text            =   "Text1"
      Top             =   1920
      Width           =   180
   End
   Begin VB.TextBox Text1 
      DataField       =   "station32"
      DataSource      =   "Adodc1"
      Height          =   270
      HideSelection   =   0   'False
      Index           =   32
      Left            =   4440
      TabIndex        =   19
      Text            =   "Text1"
      Top             =   1920
      Width           =   180
   End
   Begin VB.TextBox Text1 
      DataField       =   "station33"
      DataSource      =   "Adodc1"
      Height          =   270
      HideSelection   =   0   'False
      Index           =   33
      Left            =   4440
      TabIndex        =   18
      Text            =   "Text1"
      Top             =   1920
      Width           =   180
   End
   Begin VB.TextBox Text1 
      DataField       =   "station34"
      DataSource      =   "Adodc1"
      Height          =   270
      HideSelection   =   0   'False
      Index           =   34
      Left            =   4440
      TabIndex        =   17
      Text            =   "Text1"
      Top             =   1920
      Width           =   180
   End
   Begin VB.TextBox Text1 
      DataField       =   "station35"
      DataSource      =   "Adodc1"
      Height          =   270
      HideSelection   =   0   'False
      Index           =   35
      Left            =   4440
      TabIndex        =   16
      Text            =   "Text1"
      Top             =   1920
      Width           =   180
   End
   Begin VB.TextBox Text1 
      DataField       =   "station36"
      DataSource      =   "Adodc1"
      Height          =   270
      HideSelection   =   0   'False
      Index           =   36
      Left            =   4440
      TabIndex        =   15
      Text            =   "Text1"
      Top             =   1920
      Width           =   180
   End
   Begin VB.TextBox Text1 
      DataField       =   "station37"
      DataSource      =   "Adodc1"
      Height          =   270
      HideSelection   =   0   'False
      Index           =   37
      Left            =   4440
      TabIndex        =   14
      Text            =   "Text1"
      Top             =   1920
      Width           =   180
   End
   Begin VB.TextBox Text1 
      DataField       =   "station38"
      DataSource      =   "Adodc1"
      Height          =   270
      HideSelection   =   0   'False
      Index           =   38
      Left            =   4440
      TabIndex        =   13
      Text            =   "Text1"
      Top             =   1920
      Width           =   180
   End
   Begin VB.TextBox Text1 
      DataField       =   "station39"
      DataSource      =   "Adodc1"
      Height          =   270
      HideSelection   =   0   'False
      Index           =   39
      Left            =   4440
      TabIndex        =   12
      Text            =   "Text1"
      Top             =   1920
      Width           =   180
   End
   Begin VB.TextBox Text1 
      DataField       =   "station40"
      DataSource      =   "Adodc1"
      Height          =   270
      HideSelection   =   0   'False
      Index           =   40
      Left            =   4440
      TabIndex        =   11
      Text            =   "Text1"
      Top             =   1920
      Width           =   180
   End
   Begin VB.TextBox Text1 
      DataField       =   "station41"
      DataSource      =   "Adodc1"
      Height          =   270
      HideSelection   =   0   'False
      Index           =   41
      Left            =   4440
      TabIndex        =   10
      Text            =   "Text1"
      Top             =   1920
      Width           =   180
   End
   Begin VB.TextBox Text1 
      DataField       =   "station42"
      DataSource      =   "Adodc1"
      Height          =   270
      HideSelection   =   0   'False
      Index           =   42
      Left            =   4440
      TabIndex        =   9
      Text            =   "Text1"
      Top             =   1920
      Width           =   180
   End
   Begin VB.TextBox Text1 
      DataField       =   "station43"
      DataSource      =   "Adodc1"
      Height          =   270
      HideSelection   =   0   'False
      Index           =   43
      Left            =   4440
      TabIndex        =   8
      Text            =   "Text1"
      Top             =   1920
      Width           =   180
   End
   Begin VB.TextBox Text1 
      DataField       =   "station44"
      DataSource      =   "Adodc1"
      Height          =   270
      HideSelection   =   0   'False
      Index           =   44
      Left            =   4440
      TabIndex        =   7
      Text            =   "Text1"
      Top             =   1920
      Width           =   180
   End
   Begin VB.TextBox Text1 
      DataField       =   "station45"
      DataSource      =   "Adodc1"
      Height          =   270
      HideSelection   =   0   'False
      Index           =   45
      Left            =   4440
      TabIndex        =   6
      Text            =   "Text1"
      Top             =   1920
      Width           =   180
   End
   Begin VB.TextBox Text1 
      DataField       =   "station46"
      DataSource      =   "Adodc1"
      Height          =   270
      HideSelection   =   0   'False
      Index           =   46
      Left            =   4440
      TabIndex        =   5
      Text            =   "Text1"
      Top             =   1920
      Width           =   180
   End
   Begin VB.TextBox Text1 
      DataField       =   "station1"
      DataSource      =   "Adodc1"
      Height          =   270
      HideSelection   =   0   'False
      Index           =   47
      Left            =   4440
      TabIndex        =   4
      Text            =   "Text1"
      Top             =   1920
      Width           =   180
   End
   Begin VB.TextBox Text1 
      DataField       =   "station1"
      DataSource      =   "Adodc1"
      Height          =   270
      HideSelection   =   0   'False
      Index           =   48
      Left            =   4440
      TabIndex        =   3
      Text            =   "Text1"
      Top             =   1920
      Width           =   180
   End
   Begin VB.TextBox Text1 
      DataField       =   "station1"
      DataSource      =   "Adodc1"
      Height          =   270
      HideSelection   =   0   'False
      Index           =   49
      Left            =   4440
      TabIndex        =   2
      Text            =   "Text1"
      Top             =   1920
      Width           =   180
   End
   Begin VB.TextBox Text1 
      DataField       =   "station1"
      DataSource      =   "Adodc1"
      Height          =   270
      HideSelection   =   0   'False
      Index           =   50
      Left            =   4440
      TabIndex        =   1
      Text            =   "Text1"
      Top             =   1920
      Width           =   180
   End
   Begin VB.CommandButton Command1 
      Caption         =   "查      询   (&C)"
      Height          =   495
      Left            =   4080
      TabIndex        =   0
      Top             =   720
      Width           =   2895
   End
   Begin VB.Label Label1 
      Caption         =   "查询结果显示框:"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   240
      TabIndex        =   55
      Top             =   1440
      Width           =   2415
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()

Dim i As Integer
Dim t As Integer
Dim u As Integer            '以上三行定义循环变量
Dim lssta(1 To 70) As String            '定义一个临时存放含有起始站车次的车号的数组
Dim lsend(1 To 70) As String            '定义一个临时存放含有终点站车次的车号的数组
Dim all(1 To 70) As String              '定义一个用于存放从起始站到终点站的所有车次的数组


'设置command1的属性
With Command1
.Caption = "正在检索数据库,请稍候…"
.Enabled = False
End With



'以下代码用于清空临时数组和Text3
For i = 1 To 70
 lssta(i) = ""
 lsend(i) = ""
 all(i) = ""
Next

Text3.Text = ""

u = 1
  
  
  '以下代码是寻找含有起始站的车次
  
  For i = 1 To 186              '186是所有公交车的总数
  Adodc1.Recordset.MoveNext
   For t = 1 To 46             '46是拥有最多车站的一路车的站数
   If txtsta.Text = Text1(t).Text Then
   lssta(u) = Text1(0).Text
   u = u + 1
   End If
   Next
 Next
 Adodc1.Recordset.MoveFirst  '命令数据库指针指向第一条记录
 u = 1
  '以下代码是寻找含有终点站的车次
 
   For i = 1 To 186              '186是所有公交车的总数
   Adodc1.Recordset.MoveNext
   For t = 1 To 46             '46是拥有最多车站的一路车的站数
   If txtend.Text = Text1(t).Text Then
   lsend(u) = Text1(0).Text
   u = u + 1
   End If
   Next
 Next
 
  Adodc1.Recordset.MoveFirst    '命令数据库指针指向第一条记录

 u = 1

'以下代码的目的是在两次查询的结果中找相同的车次,即为直达车
'每找到一路车,就将其存放在数组“all”的一个元素中
 For i = 1 To 70
    For t = 1 To 70
    If lssta(i) = "" Or lsend(t + 1) = "" Then
    Exit For
    End If
    If lssta(i) = lsend(t) Then
    all(u) = lsend(t)
    u = u + 1
    End If
    Next
Next

'把查到的所有车次显示在text3中
'并根据实际情况和语境将其中插入适当的汉语连词
For i = 1 To 70
  If all(i) = "" Then
  Exit For
   Else
    If Text3.Text = "" Then
    Text3.Text = all(i) + "路车"
    Else
    Text3 = Text3 + " 和 " + all(i) + "路车"
    End If
  End If
Next

If i = 2 Then
   Text3.Text = Text3.Text + "可到达"
End If

If i > 2 Then
   Text3.Text = Text3.Text + "均可到达"
End If

If i < 2 Then
   Text3.Text = "对不起,没有这两个站之间的直达车,或者站点名称输入错误。"
End If


'设置command1的属性
With Command1
.Caption = "查      询   (&C)"
.Enabled = True
End With
    
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -