0
Good afternoon,
I made an assignment as follows:
dadosRedistribuicao.QUANTIDADE = (Decimal.Parse(txtDisponivel.Text) * Decimal.Parse(percentual)) + Decimal.Parse(distribuicao);
data.QUANTITY is decimal type, so I am converting what comes from the text field. The percentage variable and distribution comes from a grid and step like this:
string distribuicao = gvMaterial.Rows[i].Cells[2].Text;
string percentual = gvMaterial.Rows[i].Cells[3].Text;
The value of txtDisponivel is 113, the value of the percentage is 0.77 and the value of the distribution is 1. the result was to be 88,01 however is coming 8702, someone can tell me the pq ?
thank you in advance.
what value is in the variable
gvMaterial.Rows[i].Cells[3].Text
?0.77
or0,77
?– Rovann Linhalis
0.77 however I am giving a replace with percentage = percentage. Replace(",", ".");
– Stand Alone
Probably the
Parse
is being done considering "." (point) as thousands separator. It should work if you inform0,77
instead of0.77
. Or, rather, if you adjust the conversion from text to decimal number according to a pattern. The result you are getting is 113 * 77 + 1– Diego Rafael Souza