vendredi 27 décembre 2019

how do I fix this error, "There is no arguments given that corresponds to the required formal parameter"?

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