2013-07-31 62 views
-1

當我執行下面的代碼可變平均存儲78.8751432的..舍入雙值VB.net

tot = Val(txttot1.Text) + Val(txttot2.Text) + Val(txttot3.Text) + Val(txttot4.Text) + Val(txttot5.Text) + Val(txttot6.Text) + Val(txttot7.Text) + Val(txttot8.Text) 
avg = tot/pcount 
lblcrtot.Text = tot 
lblcravg.Text = avg 

我需要輪值作爲78.875

我嘗試了Math.Round(3, avg),但沒有奏效。

我需要一些建議

回答

0

試試這個

Dim rounded As Decimal = Decimal.Round(tot, 3) 
+0

基本答案更好! –