如何设定结果 [英] How to set the result

查看:74
本文介绍了如何设定结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用我的代码添加这两个值

i am trying to add these two values using my code

Me.txtPaymentMethodSubTotal.Text = ((FormatNumber(l_SubTotalWithPMFee, 2)) + (FormatNumber((txtHandlingFee.Text), 2)))



这是0.0 IN l_SubTotalWithPMFee

0.00 in txtHandlingFee.Text

我想在txtPaymentMethodSubTotal.Text
中看到结果0.00
但显示"0.000.00"

请帮助我如何获得所需的结果?



here is 0.0 IN l_SubTotalWithPMFee
and
0.00 in txtHandlingFee.Text

i want to see result 0.00 in txtPaymentMethodSubTotal.Text

but it is displaying "0.000.00"

plz help out me how can i get my desired result?

推荐答案

您正在字符串之间进行串联,因为
FormatNumber 函数将返回字符串值

为获得正确的输出,应如下所示,
you are doing concatenation between strings, because
FormatNumber function will return string value

for proper output it should be like below,
Me.txtPaymentMethodSubTotal.Text = FormatNumber(Convert.ToDouble(l_SubTotalWithPMFee) + Convert.ToDouble(txtHandlingFee.Text), 2)


祝您编程愉快!
:)


Happy coding!
:)


不需要格式化操作数.仅格式化结果
There is no need for you to format the operands. Format only the result
Dim PaymentSubTotal As Double = Val (l_SubTotalWithPMFee) + (txtHandlingFee.Text)
Me.txtPaymentMethodSubTotal.Text = FormatNumber(PaymentSubTotal)



应该可以正常工作.



Should work just fine.


这篇关于如何设定结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆