货币在vb.net文本框中以4位数字显示 [英] currency displaying in 4 digits in vb.net textbox

查看:136
本文介绍了货币在vb.net文本框中以4位数字显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用文本框显示货币值.该文本框仅用于显示grandtotal.它是另外两个文本框十进制值的总和.总计未存储在数据库中仅用于显示目的.follwing数据类型
txt1 =小数(18,2)
txt2 =十进制(18,2)
这两个值存储在数据库中

txtgrandtotal是txt1和txt2的总和,当显示其显示4个小数位时.请给我一个仅显示2个小数位的解决方案

i am using textbox to display currency value.the textbox used only for displaying grandtotal.it''s sum of another two textbox decimal values.the grand total is not stored in database only for displaying purpose.follwing data types
txt1 =decimal(18,2)
txt2=decimal(18,2)
these two values stored in database

txtgrandtotal is the sum of txt1 and txt2.when displaying its displaying 4 decimals .pls giv me a solution to display 2 decimals only

推荐答案

请尝试以下操作:

Try this:

txt1.Text = string.Format("{0:c}", value);


这篇关于货币在vb.net文本框中以4位数字显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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