//if stament to make sure users enters all necessary variables
if ((this->tbProfit->Text == String::Empty ) &&
(this->tbSharesOutstanding->Text == String::Empty )&&
(this->tbSharePrice->Text == String::Empty) ){
MessageBox::Show("Please insert Profit, Shares Outstanding and Shares Price");
}
if ((Convert::ToDouble(tbProfit->Text)&& Convert::ToDouble(tbSharesOutstanding->Text) != 0)&&
(Convert::ToDouble(tbSharePrice->Text)&& Convert::ToDouble(tbEPS->Text)!= 0))
{
EPS = Convert::ToDouble(tbProfit->Text)/Convert::ToDouble(tbSharesOutstanding->Text); //Calculates EPS
tbEPS->Text = EPS.ToString(".00");
EY = Convert::ToDouble(tbEPS->Text)/ Convert::ToDouble(tbSharePrice->Text)*(100); //calculates EY
tbEarningsYield->Text = EY.ToString(".00");
}
// else stament to calculate EY if Profit and Shares Outstanding are not giving
else
{(Convert::ToDouble(tbProfit->Text)&& Convert::ToDouble(tbSharesOutstanding->Text)!= 0);