【正文】
showdata 0 = True End Sub Private Sub Command2_Click() = 查找經(jīng)過站點最小的線路 gcaf = 2 If = Then MsgBox 您沒有輸入要查詢的起點站 !, vbInformation + vbOKOnly, 提示 ! Exit Sub End If If = Then MsgBox 您沒有輸入要查詢的終點站 !, vbInformation + vbOKOnly, 提示 ! Exit Sub End If If = False Or = Then digein = 0 showSEdata , , 0 digeitemp = digein = True Else If Then = True End If digein = 0 showSEdata , , 1 39。用于顯示列表中的標(biāo)題 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) = 站 amp。 如果要保存數(shù)據(jù),請為每一種類型的信息創(chuàng)建一個表。 3) Largechange 屬性:用戶點擊滾動條與鍵頭之間的區(qū)域時 ,value 的改變量。 9) DisabledPicture 屬性:設(shè)置或返回一個對圖片的引用,該圖片在控件無效時顯示在控件中。 3) DragDrop 事件:在 一個完整的拖放動作或使用 Drag 方法,并將其Action 參數(shù)設(shè)置位 2 時,該事件發(fā)生。 10) DataField 屬性:設(shè)置 /返回數(shù)據(jù)使用者將被綁定到的字段名。 2) Maxlength 屬性:該屬性設(shè)定在文本框控件中能夠輸入的最大字符數(shù)。 13) DisabledPicture 屬性:設(shè)置 /返回一個對圖片的引用,該圖片在控件無效時顯示在控件中。而對于后者則要求應(yīng)用程序功能完備 ,易使用等特點。然而,雖然現(xiàn)在世界上已經(jīng)充滿了多如牛毛的各種軟件,但它們依然不能滿足用戶的各種特殊需要,人們還不得不開發(fā)適合自己特殊需求的軟件。正如 Bill Gate 所說,世界上絕大多數(shù)的 Windows應(yīng)用程序是用 Visual Basic 編寫的。 7) MouseDown 事件:當(dāng)在命令按鈕上按下鼠標(biāo)按鈕時發(fā)生。 3) Enable 屬性:該控件為灰色時為 false,表示運行時不可用。 19) FontUnderLine 屬性:設(shè)置 /返回字體下劃線樣式。 12) MouseUp 事件:在控件上釋放鼠標(biāo)時發(fā)生。 3) DragOver 事件:在拖放操作正在進(jìn)行時發(fā)生。 二、 利用 adodc( ADO Data Control)進(jìn)行數(shù)據(jù)庫鏈 接: 使用 adodata 控件訪問數(shù)據(jù)庫可以完全不用編寫代碼 ,只需要通過簡單的設(shè)置和操作其屬性就可以實現(xiàn)與數(shù)據(jù)庫的連接 ,通過綁定數(shù)據(jù)感知控件 ,就能提供一個訪問數(shù)據(jù)庫的界面 ,用來實現(xiàn)對數(shù)據(jù)庫的瀏覽 ,貼加 ,刪除 ,修改等操作 . 三、 利用 DAO 對數(shù)據(jù)庫進(jìn)行操縱 : 在 visual basic 中提供了兩種與 jet數(shù)據(jù)引擎接口的方法 :data控件與數(shù)據(jù)訪問對象 (DAO)DAO 是 database object 的英文縮寫 ,要訪問數(shù)據(jù)庫一方面數(shù)據(jù)庫要提供訪問接口 ,另一方面要在編程環(huán)境中有對數(shù)據(jù)庫的支持 . DAO 模型是設(shè)計關(guān)系數(shù)據(jù)庫 系統(tǒng)結(jié)構(gòu)的對象類的集合 .他們提供了管理關(guān)系型數(shù)據(jù)庫系統(tǒng)所需要的全部操作屬性和方法 ,這其中包括建立數(shù)據(jù)庫 ,定義表 ,字段和建立表間關(guān)系 ,定位和查詢數(shù)據(jù)庫等 . 關(guān)系數(shù)據(jù)庫 介紹 : 關(guān)系數(shù)據(jù)庫是目前各類數(shù)據(jù)庫中最重要、最流行的數(shù)據(jù)庫,他應(yīng)用數(shù)學(xué)方法來處理數(shù)據(jù)庫數(shù)據(jù),是目前使用最廣泛的數(shù)據(jù)庫系統(tǒng)。 以下代碼是用來把在數(shù)據(jù)庫的所有不同的車站顯示在起始站中 39。 其思路是先掃描整個數(shù)據(jù)庫,把有起始站的車站名的記錄存放在 MSF1(1)中,把有終點站的車站名的記錄存放在 MSF1(2)中 39。 CStr(k) Next .TextMatrix(0, NC + 2) = 備注 End With For s = 0 To intpart 1 If alloks(s) = intmin Then For r = 0 To NC + 4 If MSF1(0).TextMatrix(s, r) = Then Exit For End If MSF1(1).TextMatrix(rs, r) = MSF1(0).TextMatrix(s, r) Next rs = rs + 1 End If Next MSF1(1).Refresh intmin = 9999 For k = 0 To MSF1(2).Rows 1 intcount = 9999 bfin = False For t = 0 To NC + 2 If MSF1(2).TextMatrix(k, t) = Then Exit For End If MSF1(0).TextMatrix(k + MSF1(1).Rows, t) = MSF1(2).TextMatrix(k, t) If bfin = False Then If = MSF1(2).TextMatrix(k, t) Or = MSF1(2).TextMatrix(k, t) Then If intcount = 9999 Then intcount = 0 Else intcount = intcount + 1 bfin = True End If Else If intcount 9999 Then intcount = intcount + 1 End If End If End If Next MSF1(0).TextMatrix(k, NC + 2) = MSF1(2).TextMatrix(k, NC + 2) alloks(oksn) = intcount oksn = oksn + 1 If intcount intmin Then intmin = intcount End If Next MSF1(2).Clear With MSF1(2) .TextMatrix(0, 1) = 車次 For k = 1 To NC + 1 .TextMatrix(0, k + 1) = 站 amp。第三次遞歸的時候,退出 a = MsgBox(沒有直達(dá)的車次 !您是否需要轉(zhuǎn)車 ?, vbInformation + vbOKCancel, 詢問 ) If a = vbOK Then = True = True MSF1(0).Visible = False End If Exit Sub End If showtitle (numb) Dim j As Integer Dim i As Integer Dim m As Integer Dim k As Integer Dim ball As Boolean Dim mrc As Set mrc = New Set mrc = With MSF1(numb) .Rows = 2 .Row = 1 Do While Not ball = False For m = 1 To NC If Text2(m).Text = Trim(s) Then ball = True Exit For End If Next If ball = True Then For k = m To NC If Text2(k).Text = Trim(e) Then Exit For End If Next End If If ball = True And k NC + 1 Then .Rows = .Rows + 1 For i = 1 To If (i 1) Null Then .TextMatrix(.Row, i 1) = (i 1) End If Next i .Row = .Row + 1 End If Loop End With If numb = 0 Then MSF1(0).Visible = True MSF1(1).Visible = False MSF1(2).Visible = False Else If numb = 2 Then MSF1(0).Visible = False MSF1(1).Visible = True MSF1(2).Visible = True End If End If If MSF1(0).Row = 1 And numb = 0 Then Call showSEdata(e, s, numb) End If If MSF1(1).Row = 1 And numb = 1 Then Call showSEdata(e, s, numb) End If If MSF1(2).Row = 1 And numb = 2 Then Call showSEdata(e, s, numb) End If Set mrc = Nothing End Sub Private Sub Cbe_Change() bcbm = False = = False = False showtitle 0 MSF1(0).Visible = True MSF1(1).Visible = False MSF1(2).Visible = False = False End Sub Private Sub Cbe_DropDown() bcbm = False = = False = False = False showtitle 0 MSF1(0).Visible = True MSF1(1).Visible = False MSF1(2).Visible = False End Sub Private Sub Cbm_DropDown() 39。例如,可以打印一份將數(shù)據(jù)分組并計算數(shù)據(jù)總和的報表,也可以打印另一份帶有各種數(shù)據(jù)格式的打印郵件標(biāo)簽的報表。注意:請將庫文件存入程序所在目錄。 ? 復(fù)選按鈕類的控件的基本事件: 1) Click 事件:鼠標(biāo)單擊控件時發(fā)生。 10) MouseDown 事件:當(dāng)在控件上按下鼠標(biāo)鍵時發(fā)生。 17) FontItalic 屬性:設(shè)置 /返回字體斜體樣式。 10) BackColor 屬性:設(shè)置返回背景色 11) BorderStyle 屬性:設(shè)置對象的邊框樣式 12) DataField 屬性:設(shè)定數(shù)據(jù)使用者將被綁定到的字段名 13) DataFormat 屬性:設(shè)定 DataFormat 對象,用于數(shù)據(jù)綁定 14) DataMember 屬性:從數(shù)據(jù)供應(yīng)程序提供的幾個數(shù)據(jù)成員中返回 /設(shè)定一個特定的數(shù)據(jù)成員 15) DataSource 屬性:設(shè)定控件綁定的一個數(shù)據(jù)源 16) DragIcon 屬性:設(shè)定圖標(biāo),它將在拖放操作中作為指針顯示 17) DragMode 模式:設(shè)定一個值,確定在拖放操作中所用方式