I think the Format of the Date is not correct or It may contains invalid date so the exception happens.
If you give the input as "20/8/2010", is this working?
I think year is the only the Input and Not Date, like "20/8/2010". Just want to check only year?
If so, try this
int givenYear = int.Parse( yearTextBox.Text );
int currentYear = DateTime.Today.Year ;
if ( givenYear > currentYear + 2 )
{
MessageBox.Show("It is greater than 2 year");
}
Input : 2008
Output : No Message Box
Input :2011
Output: MessageBox "It is greater than 2 year"