top of page

The Code

Public Class Form62

    Dim DTD As Single
    Dim
Cnt As Single
    Dim
TotalYears As Single

    Dim CurrDate As Date
    Dim
NDate As String

    Dim FirstDate As String
    Dim
secondDate As Date

    Dim CurrentKms As Integer
    Dim
KmTravelled As Single
    Dim
KmTravelYearly As Single
    Dim
KmTravelWeekly As Single
    Dim
KmReplaceTyre As Integer

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        'Sub Routine(1) Input CurrentKms
        InputCurrentKms()

        'Sub Routine(2) Input Current Date
        InputCurrentDate()

        'Sub Routine(3) Calculus
        CalculateDateNumber()

        'Sub Routine(4) Kilometre Calculus
        KilometreCalculus()

        'Sub Routine(5) Assign Values to Labels
        AssignLabelValue()

    End Sub

    'Sub(1)
    Sub InputCurrentKms()
       
CurrentKms = TextBox1.Text
    End Sub

    'Sub(2)
    Sub InputCurrentDate()
       
Label2.Text = TextBox2.Text
    End Sub

    'Sub(3)
    Sub CalculateDateNumber()

        'Calculate No. of Days between Dates
        Dim CuDate As Date = #6/19/2012# 'Reverse Print 'Date.Now() Rear Tyre - #9/24/2012#
        Dim CuStrDate As String = CuDate.ToString("dd MMM yyyy")

        'Current Date into CDate(NDate) Counting
        NDate = TextBox2.Text   'Input Date to NDate
        CurrDate = CDate(NDate) 'CurrDate = Numerical Value Date

        'Initial Date into Variable CDate(FirstDate) Counting
        Label1.Text = CuStrDate       ' Print Date
        FirstDate = Label1.Text       ' Exchange Date to Variable for Calculus
        secondDate = CDate(FirstDate) 'secondDate = Numerical Value Date

        DTD = DateDiff(DateInterval.Day, CurrDate, secondDate)
       
Cnt = Math.Abs(DTD * 1)
       
TotalYears = (Cnt / 365)

    End Sub

    'Sub(4)
    Sub KilometreCalculus()

        KmReplaceTyre = 6588 
       
KmTravelled = CurrentKms - KmReplaceTyre
        KmTravelYearly = (KmTravelled / TotalYears)
       
KmTravelWeekly = (KmTravelYearly / 52)

    End Sub

    'Sub(5)
    Sub AssignLabelValue()

        Label3.Text = TotalYears.ToString("n2")
       
Label4.Text = KmReplaceTyre.ToString("n2")
       
Label5.Text = KmTravelled.ToString("n2")
       
Label6.Text = KmTravelYearly.ToString("n2")
       
Label7.Text = KmTravelWeekly.ToString("n2")
       
Label8.Text = Cnt 'Total No. Days Calculus

    End Sub


    Private Sub Form62_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        'Date Configuration Private Sub Form1
        Dim CuDate As Date = #6/19/2012# 'Reverse Print 'Date.Now() Rear Tyre - #9/24/2012#
        Dim CuStrDate As String = CuDate.ToString("dd MMM yyyy")
       
Label1.Text = CuStrDate

        'Clear Variables at Start Procedure.
        'Label1.Text = ""
       
Label2.Text = ""
       
Label3.Text = ""
       
Label4.Text = ""
       
Label5.Text = ""
       
Label6.Text = ""
       
Label7.Text = ""
       
Label8.Text = ""

    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click

        'Button(3) Clear Variables
        TextBox1.Text = ""
       
TextBox2.Text = ""
       
Label1.Text = ""
       
Label2.Text = ""
       
Label3.Text = ""
       
Label4.Text = ""
       
Label5.Text = ""
     
  Label6.Text = ""
       
Label7.Text = ""
       
Label8.Text = ""

    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

        'Button(2) Show Index
        Form57.Show()
        Me.Hide()

    End Sub


End Class

Website Links-173.jpg
bottom of page