如何在文本框值中获得4个零后的零值。帮助我。 THANX [英] how to get 4 zeros after point in text box value. help me with this. THANX
本文介绍了如何在文本框值中获得4个零后的零值。帮助我。 THANX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Double total = Convert.ToDouble(dt.Rows[0]["Amount_with_markup"]);
Double paid = Convert.ToDouble(txtpaid.Text);
Double rem =Math.Round(total - paid);
txtremaining.Text = rem.ToString(".####");
推荐答案
您好,
。## ##
最大小数点后4位。请尝试.0000
:
Hi,
.####
is max. 4 decimal places. Try.0000
instead:
txtremaining.Text = rem.ToString(".0000");
希望这有帮助。
Hope this helps.
你也可以处理你的Math.Round只显示4个小数位。
You can also handle only showing 4 decimal places in your Math.Round.
Double total = Convert.ToDouble(20.04353450);
Double paid = Convert.ToDouble(19.25641654);
Double rem = Math.Round(total - paid, 4, MidpointRounding.AwayFromZero);
txtremaining.Text = rem.ToString();
这篇关于如何在文本框值中获得4个零后的零值。帮助我。 THANX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文