新聞中心
vb點(diǎn)虐 怎樣使計(jì)算結(jié)果只保留四位小數(shù)?
用這個(gè)函數(shù)把
包河網(wǎng)站建設(shè)公司成都創(chuàng)新互聯(lián)公司,包河網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為包河成百上千提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的包河做網(wǎng)站的公司定做!
Math.Round 方法 (Decimal, Int32)
將小數(shù)值舍入到指定精度。
命名空間: System
程序集: mscorlib(在 mscorlib.dll 中)
語(yǔ)法
Visual Basic(用法)
Dim d As Decimal
Dim decimals As Integer
Dim returnValue As Decimal
returnValue = Math.Round(d, decimals)
參數(shù)
d
類型:System.Decimal
要舍入的小數(shù)。
decimals
類型:System.Int32
返回值中的小數(shù)位數(shù)(精度)。
返回值
類型:System.Decimal
精度等于 decimals,最接近 d 的數(shù)字。
Math.Round(3.4666666, 4) 結(jié)果是 3.4667.
vb點(diǎn)虐 怎么設(shè)置數(shù)字保留小數(shù)點(diǎn)位數(shù)
舉個(gè)例子
Dim a As Decimal = 1.999
Dim b As Decimal = Math.Round(a, 2)
結(jié)果為b = 2.00
四舍五入保留兩位
VB.NET ,文本框限制輸入數(shù)字個(gè)數(shù)。例如不低于5位數(shù)而不大于11位數(shù)。違反則有提示。
input type="text" maxlength="11" /這是控制最大輸入字?jǐn)?shù)至于不能少于11個(gè)字,需要在點(diǎn)擊保存按鈕時(shí),通過(guò).length來(lái)控制
本文題目:vb點(diǎn)虐 數(shù)字位數(shù) vb中數(shù)字怎么表示
文章路徑:http://www.ef60e0e.cn/article/ddshgie.html