0

我到底应该怎么做?Const cdecTax As Decimal = 7.75%我尝试将其以十进制形式 (0.0775) 并尝试对其进行四舍五入,但四舍五入不起作用!

Private Sub lblFinalCostResponse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblFinalCostResponse.Click

    intFinalPrice = Format(Round, "0.00")

End Sub
4

1 回答 1

0

由于您没有真正发布足够的代码,因此给您一个确切的答案有点困难。但我假设您想计算销售税并返回商品的最终价格,所以我认为应该这样做:

Private Sub Button18_Click(sender As Object, e As EventArgs) Handles Button18.Click
    Debug.WriteLine(CalculateFinalPrice(CDec(13.3445)))
End Sub

Private Const cdecTax As Decimal = 0.0775D
Public Shared Function CalculateFinalPrice(costPrice As Decimal) As Decimal
    Return costPrice + (costPrice * cdecTax)
End Function

Output:
14.37869875
于 2013-08-22T15:03:41.433 回答