Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在表格中保存的金额没有小数点。
1 = 0.01, 10 = 0.10, 100 = 1.00, 1000 = 10.00.
我想在 vb.net 中正常显示如何将其转换为常规十进制格式?
如果该值作为字符串存储在数据库中,则将其解析为一个数字:
Dim n as Integer = Int32.Parse(theString)
然后只需将数字转换为浮点数,然后除以 100:
Dim d as Double = Convert.ToDouble(n) / 100.0
由于/运算符总是在 VB 中进行浮点除法,您可以让它进行隐式转换:
/
Dim d as Dobule = n / 100.0