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

📄 taxirec.vb

📁 VB.BET编的出租车计费PPC程序,使用SQLCE.
💻 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 + -