tags:

views:

9

answers:

1

Hi

I made student list containing roll no.,name, gender, DOB,Age ,marks1,marks2,marks3,total and avg. i want to right a code for age that is when i click on age it should display the correct age according to the DOB given. can you help using textbox events in c#

A: 

The algorithm should be

ageInYears = currentYear - birthYear - (birthMonth <= currentMonth && birthDay <= currentDay ? 0 : 1);

Subtract the years, and subtract an additional year if they haven't had their birthday yet this year.

glowcoder