Subscribe For Free Updates!

We'll not spam mate! We promise.

Automatic Year (Age) Calculation

Automatic Year (Age) Calculation
Hi Guys,
When ever the user selected a date in the calendar in date time picker or calendar control and when he pressed tab automatically the number of years will be calculated.
if (rdp_DOB.SelectedDate.HasValue)
{
DateTime dt = DateTime.Now;
DateTime BirthDate = Convert.ToDateTime(rdp_DOB.SelectedDate.Value);
TimeSpan dt1 = dt - BirthDate;
double Days = Math.Round((dt1.TotalDays) / 365.25, 0);
rtxt_Age.Text = Convert.ToString(Days);
txt_Address1.Focus();
}

Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Powered By: BloggerYard.Com