大家好,下午好。
我有一个根据百分比计算计算总毛额的程序
这是图片
http://postimg.org/image/rf05hg56p/
正如您在PC计算器上看到的那样。(基于上图)
1%= 0.01
因此意味着150,001.50的1%是1,500.015
和150,001.50 + 1,500.015 = 151501.515(基于链接中的图片)
但它似乎我的输出错了,你可以在链接上的图像中看到它。
我的问题是如何用逗号和小数点计算数字作为分数
这是我的代码
Private Sub NumericUpDown1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown1.ValueChanged
'OK
Dim input As Decimal = Double.Parse(grandtotal.Text)
Dim inputStringWithCommas As Decimal = input.ToString("0,0.00", CultureInfo.InvariantCulture)
grandtotal.Text = inputStringWithCommas
Dim vat As Decimal = Decimal.Parse(grandtotal.Text) * NumericUpDown1.Value * 0.01
VatAmount.Text = vat.ToString()
totalamount.Text = (Decimal.Parse(grandtotal.Text) + vat.ToString("n", CultureInfo.InvariantCulture))
End Sub
Private Sub VatAmount_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VatAmount.TextChanged
Dim dblValue As Decimal = VatAmount.Text
VatAmount.Text = dblValue.ToString("0,0000.00", CultureInfo.InvariantCulture)
End Sub
Private Sub totalamount_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles totalamount.TextChanged
Dim dblValue As Double = totalamount.Text
totalamount.Text = dblValue.ToString("0,0.00", CultureInfo.InvariantCulture)
End Sub
Private Sub TextBox14_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles grandtotal.TextChanged
Dim dblValue As Decimal = grandtotal.Text
grandtotal.Text = dblValue.ToString("0,0.00", CultureInfo.InvariantCulture)
End Sub
我希望你明白我的观点并帮助TYSM寻求未来的帮助。