I need to calculate the age in Years,Months and Days for which i am using the following code, but it give inappropriate result

vb Code:
  1. Dim d As Date
  2.  
  3. If Date.TryParse(Me.DOB.Text, d) Then
  4.   Dim ts As TimeSpan = Today - d
  5.   Dim y As Double
  6.   Dim m As Double
  7.   Dim ds As Double = ts.TotalDays
  8.  
  9.   y = Math.Floor(ds / 365)
  10.   ds -= y * 365
  11.   m = Math.Floor(ds / 31)
  12.   ds -= m * 31
  13.  
  14.  
  15.   Me.TxtYears.Text = cstr(y)
  16.   Me.TxtMonths.Text=Cstr(m)
  17.   Me.TxtDays.Text = Cstr(ds)
  18. End If

I also need to do the reverse calculation i.e get the DOB from the Age using the txtYears, txtMonths and TxtDays

Plz Help Me