I'm coding a simple calculator, and it needs to be displaying 2 digits after the decimal, but I can't figure it out. The rest of the program works perfectly, and so does the quotient button, but it's just displaying too many digits after the decimal. Here's what I have:
private double _leftop = 0;
private double _rightop = 0;
private double _quotient = 0;
private void BtnQuotient_Click(object sender, EventArgs e)
{
if (Double.TryParse(TxtLeftOperand.Text, out _leftop) == true && Double.TryParse(TxtRightOperand.Text, out _rightop) == true)
{
_quotient = _leftop / _rightop;
TxtResult.Text = Convert.ToString(_quotient);
}
else
{
TxtResult.Text = "Error";
}
}