When you divide two integers, you'll get only the integer part of that division.
The easiest way to change it is:
decimal a = 10 / (decimal)3;
You can also put an "m" after a number to indicate it's a decimal
type. If you wanted to convert it to float
, you use "f" instead.
decimal a = 10 / 3m;
You can also call Convert functions:
decimal a = 10 / Convert.ToDecimal(3);
In these cases it's only needed to cast only one of your values, as both variables are numeric.
In your code, on the other hand, you'll need to cast both as you can't divide a string.
Applying that to your code, it could be something like this:
outputtextblock1.Text = (Convert.ToDecimal(cf1.Text) / Convert.ToDecimal(cf2.Text)).ToString()
Or maybe like this:
outputtextblock1.Text = (Decimal.Parse(cf1.Text) / Decimal.Parse(cf2.Text)).ToString();
I hope this helps.