Searching for the online age calculator? Don't have time to search on Internet? Want to find age locally on your computer? Then don't worry! We are going to show you - how to create your own birth year calculator using VB.net. So let us do it!
If you want to compile and run the following code then make sure you have installed Visual Studio and DotNet 3.5 framework on your Windows PC. Don't have Visual Studio? Never mind, I have posted a link to download this dob calculator executable file.

Calculate My Age - Your Age Counter

real age calculator

What you have to do is just create a new vb.net form project in your Visual Studio. Drag and drop two Date Time Picker and change their name to dtp1 and dtp2 respectively from their properties section. Also drag and drop two buttons and change their text to Calculate and Exit respectively. Also change their name to btnCalculate and btnExit from their properties section respectively and then copy paste below code by double click on form-

Public Class Form1
    Dim DV1 As Date
    Dim DV2 As Date
    Dim DT As TimeSpan
    Dim Diff As Double

    Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
        Me.Close()

    End Sub

    Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click
        DV1 = Me.dtp1.Value.ToShortDateString
        DV2 = Me.dtp2.Value.ToShortDateString
        DT = (DV2 - DV1)
        Diff = DT.Days
        Me.lblAge.Text = ("You are - " + Str(Int(Diff / 365)) + " Years ")
        Diff = Diff Mod 365
        Me.lblAge.Text = Me.lblAge.Text + (Str(Int(Diff / 30)) + " Months ")
        Diff = Diff Mod 30
        Me.lblAge.Text = Me.lblAge.Text + (Str(Diff) + " Days old")
    End Sub
End Class

To download source code for this age calendar then click on the link given below-
To download executable file of this age calculator then click on the link given below-

(Don't worry, file and source code is clean and virus free!)

Something gone wrong while compiling this code? Then leave your message below in the comment section. I will try my best to solve your queries. Thank you!
Axact

Sainath Parkar

Sainath is an engineering student and currently pursuing Bachelor of Engineering (BE) degree in Computer Engineering. He is from Mumbai, Maharashtra, India. He is very much technology geek and enthusiastic person. Apart from being a blogger, he is a gamer and like to play lots of newer generation games on PC. He also like Programming, Drawing.

Post A Comment: