I have an integer value of 1500 in the variable valuemonetary and I want to send it to another valuevalue variable like 1500.00. How to do in C #. I've tried conversions and nothing happens ... In the end, the variable ValueDecimal should be filled as 1500.00. I made many forms and nothing happens. I do not know what to do. Part of the routine is this;
string valorreceb = ((registro.Cells["Valor"].Value.ToString()));
valorreceb = valorreceb.ToString().Replace(".", ",");
if (string.IsNullOrEmpty(registro.Cells["Valor"].Value.ToString()) || valorreceb == "0")
{
String valor2 = "0.00";
cepXml.AppendFormat("\t\t<Valor>{0}</Valor>\r\n", valor2);
}
else
{
decimal d = Convert.ToDecimal(valorreceb);
string Valordecimal = Convert.ToString(d);
string sVariavelNova = Valordecimal.Replace(",", ".");
cepXml.AppendFormat("\t\t<Valor>{0}</Valor>\r\n", Valordecimal);
}