End Sub
Private Sub Timer1_Timer()
bt = False
If Check1.Value = 0 Then
Form1.IsBeginS = True
Else
Form1.IsBeginS = False
End If
Load Form1
Form1.Show
Timer1.Enabled = False
End Sub
Private Sub Timer2_Timer()
Timer1.Enabled = True
Timer2.Enabled = False
End Sub
2:主界面设计:
代码设计:
Dim bcbm As Boolean
Dim bcb1 As Boolean
Dim bcbs As Boolean
Dim bcbe As Boolean
Dim tm As Integer
Dim intpart As Integer
Public IsBeginS As Boolean
Public Sub showallstation()
' 以下代码是用来把在数据库的所有不同的车站显示在起始站中
' 其思路是如果在启动界面中,用户选择了更新数据库,则扫描整个数据库,并把不同的车站加到起始站中
' 并把这些车站名存放在一文本框中,以用于下次读取
' 如果用户没有选择更新数据库,则直接从文件中读取车站存放在起始站中
' 这样做的好处是可以大大提高效率,如果每次启动都要重新检索数据库,则要花费大量的时间
If IsBeginS = False Then '用户选择了更新数据库
Dim strm As String
Dim mrc3 As ADODB.Recordset
Set mrc3 = New ADODB.Recordset
Set mrc3 = Adodc1.Recordset
mrc3.MoveFirst
Do While Not mrc3.EOF
For i = 1 To NC
strm = Text2(i).Text
If strm = "" Then
Exit For
End If
For j = 0 To cbs.ListCount
If cbs.List(j) = Trim(strm) Then
Exit For
End If
Next
If j > cbs.ListCount Then
cbs.AddItem Trim(strm)
End If
Next
mrc3.MoveNext
Loop
If Mid(App.path, Len(App.path) - 1, 1) <> "\" Then
Open App.path + "\allstation.dat" For Output As #1
Else
Open App.path + "allstation.dat" For Output As #1
End If
Print #1, CStr(cbs.ListCount)
For k = 0 To cbs.ListCount - 1
Print #1, , cbs.List(k)
Next
Close #1
Set mrc3 = Nothing
Else '用户没有选择了更新数据库
Dim strbs As String
Dim intnb As Integer
If Mid(App.path, Len(App.path) - 1, 1) <> "\" Then
Open App.path + "\allstation.dat" For Input As #1
Else
Open App.path + "allstation.dat" For Input As #1
End If
Input #1, strbs
intnb = CInt(Val(strbs))
For k = 0 To intnb - 1
Input #1, strbs
cbs.AddItem strbs
Next
Close #1
End If
End Sub
Public Sub showtitle(numt As Integer)
'用于显示列表中的标题
For j = 0 To 2
If numt = 2 And j = 1 Then
Exit Sub
End If
MSF1(j).Clear
Dim i As Integer
With MSF1(j)
.Rows = 2
.Cols = NC + 3
.TextMatrix(0, 1) = "车次"
For k = 1 To NC + 1
.TextMatrix(0, k + 1) = "站" & CStr(k)
.ColWidth(k) = 1000
Next
.TextMatr
首页 上一页 1 2 3 4 5 6 7 下一页 尾页 4/7/7
公交车查询系统+vb(四)由毕业论文网(www.huoyuandh.com)会员上传。