?? taxirec.vb
字號:
Public Class TaxiRec
Inherits System.Windows.Forms.Form
Friend WithEvents LB As System.Windows.Forms.ListBox
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'該調用是 Windows 窗體設計器所必需的。
InitializeComponent()
'在 InitializeComponent() 調用之后添加任何初始化
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
MyBase.Dispose(disposing)
End Sub
'注意: 以下過程是 Windows 窗體設計器所必需的
'可以使用 Windows 窗體設計器修改此過程。
'不要使用代碼編輯器修改它。
Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.LB = New System.Windows.Forms.ListBox
Me.MainMenu1 = New System.Windows.Forms.MainMenu
Me.MenuItem1 = New System.Windows.Forms.MenuItem
Me.TextBox1 = New System.Windows.Forms.TextBox
'
'LB
'
Me.LB.Location = New System.Drawing.Point(8, 24)
Me.LB.Size = New System.Drawing.Size(224, 242)
'
'MainMenu1
'
Me.MainMenu1.MenuItems.Add(Me.MenuItem1)
'
'MenuItem1
'
Me.MenuItem1.Text = "返回"
'
'TextBox1
'
Me.TextBox1.Enabled = False
Me.TextBox1.ForeColor = System.Drawing.Color.Blue
Me.TextBox1.Location = New System.Drawing.Point(8, 4)
Me.TextBox1.Size = New System.Drawing.Size(224, 21)
Me.TextBox1.Text = " 乘車時間 費用 公里數"
'
'TaxiRec
'
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.LB)
Me.Menu = Me.MainMenu1
Me.Text = "TaxiRec"
End Sub
#End Region
Dim cn As System.Data.SqlServerCe.SqlCeConnection
Dim SQL As String
Dim SQLEngine As System.Data.SqlServerCe.SqlCeEngine
Dim rdr As System.Data.SqlServerCe.SqlCeDataReader
Dim cmd As New System.Data.SqlServerCe.SqlCeCommand
Dim fullname As String '可執行文件含路徑
Dim myAppPath As String
Dim col1 As DateTime
Dim col2 As Integer
Dim col3 As Integer
Dim SumFee As Integer
Dim SumDistance As Integer
Private Sub TaxiRec_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
fullname = System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase
myAppPath = System.IO.Path.GetDirectoryName(fullname) '全局可執行文件路徑變量
'從SQLCE讀取數據并放入到LISTBOX中顯示出來
cn = New System.Data.SqlServerCe.SqlCeConnection("Data Source=" + myAppPath + "\taxirec.sdf")
If cn.State = ConnectionState.Open Then cn.Close()
cn.Open()
cmd = New System.Data.SqlServerCe.SqlCeCommand("SELECT * FROM taxirec", cn)
rdr = cmd.ExecuteReader
While rdr.Read
col1 = rdr.GetDateTime(0)
col2 = rdr.GetInt16(1)
col3 = rdr.GetInt16(2)
SumFee = SumFee + col2
SumDistance = SumDistance + col3
LB.Items.Add(" " + System.Convert.ToString(col1) + Microsoft.VisualBasic.Right(" " + Str(col2), 5) + "元" + Microsoft.VisualBasic.Right(" " + Str(col3), 5) + "公里")
End While
LB.Items.Add("---------------------------------------------------------")
LB.Items.Add(" 合計:" + Microsoft.VisualBasic.Right(" " + Str(SumFee), 5) + "元" + Microsoft.VisualBasic.Right(" " + Str(SumDistance), 5) + "公里")
cn.Close()
End Sub
Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
Me.Hide()
End Sub
End Class
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -