I was to call a method within an else if to use for if users age is < 21 or|| >75 output message box. this error is coming up when i try to call the method
this is my code
public int GetAge(string DOB, DateTime startDate)
{
int driverAge = startDate.Year - DateTime.Parse(DOB).Year;
if (startDate.Month < DateTime.Parse(DOB).Month || (startDate.Month == DateTime.Parse(DOB).Month && startDate.Day < DateTime.Parse(DOB).Day))
{
driverAge--;
}
return driverAge;
}
...
else if (GetAge())
{
}
Aucun commentaire:
Enregistrer un commentaire