How to get default date of birth when we give age?
Hai Guys,
I need to get the default date to the dob(dateTime picker) when i give the age in textbox. can any one help me.....
thanks in advance
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Jignesh TrivediRank #16 · 50.3K reputationPosted Aug 1, 2012, 8:58 PM EDT
try...
int age = 20; // set age from textbox like Convert.ToInt32(TEXT1.Text)
DateTime mydate = DateTime.Now;
mydate = mydate.AddYears(-1 * age);
mydate is set to you datetime picker...
it will return 2/08//1992
hope this will help you.
Santhosh Kumar JayaramanRank #563 · 4.3K reputationPosted Aug 1, 2012, 8:54 PM EDT
divya146 reputationPosted Aug 1, 2012, 9:12 PM EDT