Ahmad Al Raeesi
asked on
Calculating my Age by entering Birthday Date ?
Hi I am newbie in VB.net, and I want to create application can calculate age by entering Birth date
and the result give me how old am I + month. For example: if my birthday was in 11-9-1990 then
the result must be like this; 16 year old + 11 month.
I am using this code below: "my code will give the result 17"
Dim Birth As DateTime = CDate(TextBox1.Text)
Dim age As Long = DateDiff(DateInterval.Year , Birth, Today)
Birth = Birth.AddYears(CInt(age))
TextBox2.Text = age.ToString() ' result
and the result give me how old am I + month. For example: if my birthday was in 11-9-1990 then
the result must be like this; 16 year old + 11 month.
I am using this code below: "my code will give the result 17"
Dim Birth As DateTime = CDate(TextBox1.Text)
Dim age As Long = DateDiff(DateInterval.Year
Birth = Birth.AddYears(CInt(age))
TextBox2.Text = age.ToString() ' result
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER