0

The added or subtracted value results in un-representable Date Time. Parameter name:T

    Dim offset = New Date(1, 1, 1)

    Dim dateOne = dtpbdate.Value
    Dim dateTwo = Date.Now

    Dim diff As TimeSpan = dateTwo - dateOne

    Dim years = (offset + diff).Year - 1



    If years < 18 And years < 50 Then
        MsgBox("Age requirement must be 18 - 50 years old!")
    Else
        txtage.Text = years.ToString
    End If
  • 1
    https://stackoverflow.com/questions/16874911/compute-age-from-given-birthdate – Hans Passant Apr 13 '21 at 15:18
  • I think you might have a little logic error in checking the years if years < 18 And years < 50. Shouldn't it be years >= 18 And years <= 50 ? – Hursey Apr 13 '21 at 20:41

0 Answers0