Try this
use
TryParse
instead of
Parse
int yearofpurchase=0, monthofpurchase=0, CurrentMonth=0, CurrentYearend=0;
float Cost=0, DepnRate1=0;
int.TryParse(txtYearofPurchased.Text, out yearofpurchase);
int.TryParse(txtYearofPurchased.Text, out yearofpurchase);
int.TryParse(txtMonthofPurchased.Text, out monthofpurchase);
int.TryParse(txtCurrentMonthEnd.Text, out CurrentMonth);
int.TryParse(txtCurrentYearEnd.Text, out CurrentYearend);
int.TryParse(txtCost.Text, out Cost);
int.TryParse(txtDepnRate1.Text, out DepnRate1);