计算数字百分比

时间:2017-05-12 20:26:56

标签: vb.net

您好我正在尝试创建一个数字的百分比。

当用户输入号码时,应该找到该号码的18%。

代码:

If ComboBox2.SelectedIndex = 0 Then

            tax += saleprice / 100 * 0.18
        End If

我如何在vb.net中打造18%的价格????任何公式? 但当我输入它时,它没有正确输入数据库,所以我没有得到任何结果的帮助。注意:销售价格和税收在班级顶部声明。

以下是代码的其余部分:

  Dim Query As String
        Query = "insert into pos.artikli(kod,ime,mera,kol,nabavna,profit,prodazna,tax,dolgopis,dolgopis2,proizvoditel,mkproizvod) values ('" & TextBoxKod.Text & "','" & TextBoxNaziv.Text & "','" & edmera & "','" & kolicina & "','" & TextBoxNabavna.Text & "','" & procentdobivka & "','" & TextBoxProdazna.Text & "','" & tax & "','" & TextBoxOpis.Text & "','" & TextBoxOpis2.Text & "','" & TextBoxProizvoditel.Text & "','" & mkpr & "')"
        COMMAND = New MySqlCommand(Query, konekcija)
        READER = COMMAND.ExecuteReader

1 个答案:

答案 0 :(得分:0)

提示/示例:

    'http://www.convertit.com/Go/ConvertIt/Calculators/Finance/Sales_Tax_Calc.ASP
    Dim tax As Decimal
    Dim test() As Decimal = {1D, 100D, 1000D}
    Dim taxrate As Decimal = 18D / 100D '18%

    For Each saleprice As Decimal In test
        tax = saleprice * taxrate
    Next