top of page

The Code

Public Class Form63

 

    Dim FirstDate As String
    Dim
CalculateFirstDate As Date

    Dim SecondDate As String
    Dim
CalculateSecondDate As Date

    Dim DTD As Single
    Dim
CountDays As Single
    Dim
TotalYears As Single

    Dim DecimalPlace As String = "n3"

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

        Form57.Show()
        Me.Hide()

    End Sub

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

        'Sub Rountine(1)
        '## Input Date for Calculus ##

        InputDateValue()

        'Sub Routine(2)
        '## Calculate Days Difference ##

        InputCalculateDays()

        'Sub Rountine(3)
        '## Assign Values to Labels ##

        InputAssigntoLabels()

    End Sub

    ' ## Sub(1) ##
    Sub InputDateValue()

        FirstDate = TextBox1.Text
        CalculateFirstDate = CDate(FirstDate)

        SecondDate = TextBox2.Text
        CalculateSecondDate = CDate(SecondDate)

    End Sub

    '## Sub(2) ##
    Sub InputCalculateDays()

        DTD = DateDiff(DateInterval.Day, CalculateFirstDate, CalculateSecondDate)
       
CountDays = Math.Abs(DTD * 1)
       
TotalYears = (CountDays / 365)

    End Sub

    ' ## Sub(3) ##
    Sub InputAssigntoLabels()

        Label1.Text = CountDays
        Label2.Text = TotalYears.ToString(DecimalPlace)

    End Sub

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

        '## Clear TextBox & Labels ##
        TextBox1.Text = ""
       
TextBox2.Text = ""
       
Label1.Text = ""
       
Label2.Text = ""

    End Sub

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

        '## Clear Labels at Runtime Startup ###
        Label1.Text = ""
       
Label2.Text = ""

    End Sub


End Class

Website Links-173.jpg
bottom of page