Hello so I have this condition:
if (DateTime.Now.Subtract(dateTimePicker_Doc_BirthDate.Value).Days/(365)<18)
{
this.errorProvider1.SetError(this.dateTimePicker_Doc_BirthDate, "Atleast 18 years old");
valid = false;
}
And I want to make another that contains graduation of this person and set restriction that at the time when he graduat must be atleast 18
years older.
I have tried this: but it does not work
if (DateTime.Now.Subtract(dateTimePicker_Doc_Graduation.Value).Days / (365) < 18 + (18))
{
this.errorProvider1.SetError(this.dateTimePicker_Doc_Graduation, "Atleast 18");
valid = false;
}